fbpx

Sometimes you might want your gutenberg blocks to cover full width of the screen. WordPress provides options to do that, you just need to include the support in your theme. You can use this little piece of code to do that in your functions.php –

<?php
 /*
        Register support for Gutenberg align in your theme
 */ 
 function mytheme_setup() {
 add_theme_support( 'align-wide' );
 }
 add_action( 'after_setup_theme', 'mytheme_setup' );

You can also modify default css that alignwide and align full brings-

.entry-content .alignwide {
    margin-left  : -80px;
    margin-right : -80px;
}
.entry-content .alignfull {
    margin-left  : calc( -100vw / 2 + 100% / 2 );
    margin-right : calc( -100vw / 2 + 100% / 2 );
    max-width    : 100vw;
}