Question:
Why doesn't the overflow:hidden property function on fixed parent/children elements?
Example:
.parent { position: fixed; overflow: hidden; width: 300px; height: 300px; background: #555; } .children { position: fixed; top: 200px; left: 200px; width: 150px; height: 150px; background: #333; }
<div class="parent"> <div class="children"></div> </div>
Answer:
CSS clip: rect() can clip a fixed positioned element to its parent. However, it has some caveats:
See the updated JSFiddle demo for an example of using clip: rect().
Additional Notes:
The above is the detailed content of Why Doesn't `overflow: hidden` Work on Fixed Positioned Parent and Child Elements?. For more information, please follow other related articles on the PHP Chinese website!