Full-Width Bar

This approach uses three lines of CSS to create a full-width bar. It uses negative margins to pull the element to the edges of the screen, then padding to contain the content. Works in IE9+.

The margins and padding are calculated using calc, and are based on the width of the entire viewport (100vw) - the width of the parent container (100%). This means you never have to adjust these styles if you decide to change the width of your container.

Width can be applied to the container using any standard method (px, %, em, etc.).

This approach continues to work for elements with:

Thanks to @chuckhendo (Carl Henderson) for giving me ideas. He'll have an awesome SCSS mixin for this in about two minutes.

Forever Yours - @Keale2