I have all my content wrapped in a container element with a fixed width.
But I have a
Another idea, which in modern browsers does stretch the .breakout
only to the width of the browser window:
body, html {
overflow-x: hidden;
margin: 0;
padding: 0;
}
div {
padding:0.5em;
}
.container {
width:300px;
background-color:rgba(255,255,0,0.5);
margin:auto;
}
.breakout {
margin:1em -100%; /* old browsers fallback */
margin:1em calc(50% - 50vw);
background-color:rgba(255,0,255,0.5)
}
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.
Break out of container
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.
Edit: The one and only Chris Coyier explains Full Width Containers in Limited Width Parents, which is somewhat similiar.