I am trying to understand why setting overflow-x: hidden in the body of an HTML page makes my position: fixed element even if I set it to position: absolute .
The effect is better understood in this demo .
Here is the code:
HTML:
<div class='background'></div> <div class='page'></div> <div class='page'></div> <div class='page'></div> <div class='page'></div>
CSS
html, body { width: 100%; height: 100%; padding: 0; margin: 0; overflow-x: hidden; } div.page { positon: relative; width: 100%; height: 100%; min-height: 100%; border: 1px solid red; margin-bottom:200px; } div.background { background: blue; position: absolute; width: 100%; height: 20%; }
Question
What is the relationship between overflow-x: hidden and positioning? Why does setting this property cause my element to become position: fixed instead of position: absolute ?
html css
drinchev Feb 05 '13 at 22:36 2013-02-05 22:36
source share