Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Pellentesque sit amet venenatis diam, at interdum tortor.
I have the following markup where #content is 80% wide and contains .slide elements. I want the slides to be as wide as their grandparent (i.e. bod
If your surrounding content can demand a different combination of positioning properties on their own, you could always go with the following.
body {
margin: 0;
font: medium monospace;
background: lightgray;
}
#content {
margin: auto;
width: 80%;
background: white;
}
#content:before,
#content:after {
content: "";
display: table;
}
.slide {
height: 6em;
background: indianred;
width: 125%; /*100*(100/80)*/
margin-left: 50%;
transform: translateX(-50%);
}
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Pellentesque sit amet venenatis diam, at interdum tortor.