This is something I’ve wondered for a while. Given the following example:
You’ll notice I need <div class="content"> inside each full-width block in order to centre it to 1000px. Is this possible without the repeated <div> inside each block (nav, article and footer). It seems like this should be somehow possible with padding or pseudo elements before/after to make the space…
Essentially I’m wondering whether it’s possible to get the same visual output with this HTML:
Making the article,nav and footer elements 1000px centres the content but stops the blocks filling the width. This is possible with a background image on the that contains the background colours but this is obviously not a very nice solution either.
Indeed, I’m only using fixed width for this example. Interesting approach. The only obvious problem is that it makes the <body> incredibly wide. I suppose overflow-x: hidden on the body would fix it, although it seems like a bit of a hack.
I did manage to do it myself with box-shadow:
Done on the nav element here… but box-shadow support with multiple shadows isn’t great.
edit: Actually according to http://caniuse.com/#feat=css-boxshadow IE supports multiple shadows from 9+, that’s perfectly fine for my use-case… in this instance IE8 uses would just see whitespace…
Yeah not to mention IE8 is almost non existent. TBH my old work and this work have this (correct IMO) mentality: make sure IE8 users can access the content fine, but don’t care about design issues.
It depends on the overall look you are going for, but if the first/last elements in the markup can’t be used and place the borders on them, then :before for a top border, and :after for the bottom border is fine.