-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to style alignfull and alignwide #8289
Comments
Hi, shameless plug here ;) This might be of interest to you: https://codepen.io/webmandesign/post/gutenberg-full-width-alignment-in-wordpress-themes |
Also, the issue you describe is actually related to Windows OS only from what I know. The only way around it would be to set |
+1 is for noticing different value of Shouldn't this be filed to Chrome/Firefox/Edge developers as a bug? |
@manake According to https://cloudfour.com/thinks/breaking-out-with-viewport-units-and-calc/ the bugs were already reported… |
But that doesn't fix the problem. Yes, it prevents the horizontal scrollbars, but the content still overflows. You won't see the left and right edges of the image. It seems there is no solution at all to this. |
@smerriman That's true. However, there is no other way around, unfortunately. |
@manake @smerriman @webmandesign I test another 2 solutions.
I must optimize my code but currently it works fine. |
Unfortunately,
@everyone |
I'm not really sure this is something we should cover explicitly in our documentation, because how you style these can vary from site to site. On my own website I'm using a weird "reverse grid" with wildcard selectors and such, however on another site our full-width option doesn't actually stretch the full width, so it's styled with a simple max-width. And when you factor in themes with sidebars it gets even more complicated because some pages may treat full alignment differently from others. Definitely recognise that the world needs more examples, to be clear… I'm just not sure it should be in official documentation. Thoughts from the CSS and themey folks? Should we prescribe a recommended/official method, or let other sites document the various approaches? |
I agree — I'm not sure it's necessary to have a preferred/recommended method in the docs. It has been helpful to have the sidebar example that's linked from the handbook currently, but I imagine that'll get less useful once more and more themes exist to learn from. |
I agree - websites, themes have a unique design and do not always have the same solutions and needs. However, it would be helpful to have examples for programmers that can help them save some time |
I think in this case it would be useful to include something given it's a core feature with no actual valid CSS implementation. I see the twentythirteen theme cuts off the sides of full width images and use a rather nasty hack of 96vw for full width non-images - if this WordPress' official recommendation, it's probably worth mentioning. I've always used alternative methods - eg actually rewriting the divs to break out when needed. My first thought when seeing Gutenberg's version was 'hey cool, there's now a proper way to do it'. My second was 'wait, it doesn't work at all - why was it included then?'. I'm sure a lot of other people will be thinking the same thing - would love a page to refer to. |
Best: They should include Copy and paste code in the documentation is needed because look what I did in the first post: I opened 10 links from Google, wasted time and didn't find any solution. |
After doing much of the same research as most people did here I decided instead of trying to make the wide classes break outside of my wrapper I would add the following to add a max width to blocks without the classes. I have not tested this thoroughly enough yet but it seams to work on columns, images, block quotes. So I just removed the page templates wrapper and assume it as 100%. Here is a pen with the WP markup as closely emulated as I could https://codepen.io/nickfmc/pen/vvbWQa
|
@nickfmc This is exactly what I will be going for and I thought of this b4 even reading your comment. I think its way more intuitive then these complicated negative margins combined with calc and you need overflow ... But I think I just go with .entry-content > div:not(.alignfull),
.entry-content > p:not(.alignfull) { or even just .entry-content > *:not(.alignfull) to make it independent of Gutenberg and just apply to all elements that are not specified to be wide (with Gutenberg or just by manually adding that class in). Not sure how the //edit Playing arround with this you actually have to at least also target Another cool thing you can do is you can use the image block make it align left/right and then use the advanced section in the GB sidebar to put the Here is what I got so far: https://codepen.io/nnico/pen/mvJQyB?editors=0100 |
Agree @nextgenthemes ... in fact I'd say you have to go with the star selector you suggested because it's not just
I have yet to really encounter any drawbacks. It works perfectly, and no scrollbars for anyone! |
Bravo, thanks guys! This solution is amazing! |
I think there should definitely be a recommended way to implement these styles and it should be used by all default WordPress themes. Plugin creators need to implement default styles for their blocks and currently it seems impossible to ensure a block with wide or full alignment will work well on multiple themes. A combination of @nickfmc and @onetrev seems to be the way to go. How do we go about getting some action on this? Submit a ticket on core trac suggesting the change to all default themes? |
Interesting solution @WraithKenny, thanks for posting! I used to use the solutions posted by @nickfmc and @nextgenthemes but it never felt like the ideal fix. However, I just recently went back to using using
|
No Mac here. See above, Windows 10 only. No horizontal scrollbar. You can as per Twenty Twenty use |
Related: #19331 |
Quoting from your liked article:
I think it's totally ridiculous to be concerned about a few I have not looked deeply at what TwentyTwenty is doing but that I and others are suggesting are a few basic CSS lines to make this happen. Not sure why that has to be that complicated. |
Sorry for missing this issue initially. I agree that alignments are hard to support these days. We're rethinking these to simplify things for theme authors in #20650 |
The documentation https://wordpress.org/gutenberg/handbook doesn't contain information on how to style
alignfull
andalignwide
.jQuery('body').width()
returns1884
window.innerWidth
returns1901
When I do:
then the resulting container is
1901px
wide (thus producing horizontal scrollbar). To make it right it would have to be1884px
.Can you please clarify how themes should style
alignfull
?These places (top google results) contain wrong styling information:
The text was updated successfully, but these errors were encountered: