I would like to have a child div extend to be the same width as it's parent's parent. So with HTML structure like this:
<div class="pp">
<div class="p">
<p>
Some text
</p>
<div class="c">
This is the thingy!
</div>
<p>
Some more text
</p>
</div>
</div>
I would like div.c
to extend to the borders of div.pp
.
I know this is possible with negative margins, but in my situation I am not aware of the margins of div.pp
beforehand. I'm aware I could write some JavaScript to do this, but I am interested in a CSS only solution. I'm also aware that changing the structure of the HTML could solve this problem, however that is also not an option.
Here is fiddle illustrating the HTML and some helpful CSS:
https://jsfiddle.net/y37mLkzu/1/
There is an example there of fixing this with negative margins.