3 ms·
It doesn't work properly. The body has a max-width of 750px, and the header uses a padding hack of 'calc(50vw - 50%)'. That 50% means '50% of the containing ele
by onion2k 7y ago
It doesn't work properly. The body has a max-width of 750px, and the header uses a padding hack of 'calc(50vw - 50%)'. That 50% means '50% of the containing element', so if 50vw is more than 750px (eg your viewport is more than 1500px wide) the header element stops being centred and starts spilling over on the right hand side.
- horsawlarway 7y agoYeah... Looks terrible for me.
- Dragory 7y agoSeems to work properly in Firefox (https://i.imgur.com/AQ2M1G3.png https://i.imgur.com/AQ2M1G3.png) but breaks in Chrome (https://i.imgur.com/U2tVg2k.png); https://i.imgur.com/U2tVg2k.png); Chrome doesn't accept the margin value (https://i.imgur.com/pH7X0ZO.png https://i.imgur.com/pH7X0ZO.png). When the margin works, the logic makes sense. 50vw sets the padding of the side in question (e.g. left) to the middle of the screen, 50% subtracts half of the containing element's width (<body>) from it. Doing this for both left and right and then negating it with equal negative margins results in the content area in the header being centered and having the same width as body, but the padding stretching out to the edges of the window.
- Finster 7y agoThere's already a PR to fix this, looks like there's a missing space after one of the minus signs.
- emagdnim2100 7y agoA good place for the under-appreciated CSS ‘clamp’ function!
- onion2k 7y ago... that doesn't work in Safari or iOS, or non-Chrome Android browsers yet.