Having trouble setting a fixed div to be the same width as its parent element, which is itself size relative to another div.
To clarify, here is a code snippet that demonstrates the issue:
HTML
<div class="grandparent">
<div class="parent">
<div class="fixed"></div>
</div>
</div>
CSS
.grandparent {
width:100px;
position:relative;
}
.parent {
width:70%;
position:relative;
}
.fixed {
width:100%;
position:fixed; /* Trying to make this div fixed and have 100% width related to parent */
}
Check out this JSFiddle.
How can the .fixed div inherit the width of its parent while maintaining a fixed position?
Your insight would be appreciated. Thanks.