Archived topic
Set one block to full width
3 replies · Started by Kar Yung on November 19, 2020
Update to old topic: https://generatepress.com/forums/topic/set-one-block-to-full-width/#post-15381063
What’s the current best implementation of this? I think this is also super popular for tech websites where the image needs to be way bigger to show details, such as…
https://www.theverge.com/21572796/amd-radeon-rx-6800-review-4k-gaming-test-benchmarks
Hi,
You can create a CSS class that applies "full page width" size to elements by adding this CSS:
.full-page-width {
margin-left: calc(-100vw / 2 + 100% / 2);
margin-right: calc(-100vw / 2 + 100% / 2);
max-width: 100vw;
width: auto;
}
.full-page-width * {
width: 100%;
}
You then add "full-page-width" to your content block's CSS class selectors on their Advanced settings.
Thanks Elvin. But what if I don't want it to take the entirety of the page? As in I just want the image to be a BIT wider than the width of the text block, which CSS property should I tweak?
Cause as far as I know what you gave me would stretch the image across the entire width?
The best method to build that layout is using:
https://wordpress.org/support/plugin/generateblocks/
You would need to set the content container to full width first:
https://docs.generatepress.com/article/content-container/
But then inside GB you can set whatever width you want to the container blocks:
https://docs.generateblocks.com/article/container-overview/
Hope this helps :)