Check the below html snippet -
<div id="y">
<div id="x"></div>
</div>
Below is the CSS snippet
#x {
display: block;
background: red;
height: 80px;
width: 100%;
top: 0;
position: fixed;
}
#y {
display: block;
position: relative;
height: 80px;
width: 100%;
}
Behavior found is - The inner div "#x" occupies 100% of the width when its position is set as fixed. and the width takes a px value approx 20% of the width when its position is set to relative.
Question - Is it possible for a div element to have its width change just because it position value is fixed or relative? Or is something else happening(though i found nothing else).
Note - Could not repro the scneario in jsfiddle.