Freezing a div within a div
15,673
Solution 1
Add position: relative;
to container, and remove floats and add position: fixed;
to the block you want to fixate.
Result:
Solution 2
You want to add:
position:fixed
to the div that you want fixed. Doing this will position this div and it's containing elements fixed.
Author by
Amit
Updated on June 04, 2022Comments
-
Amit almost 2 years
My basic layout is a couple of divs within a div - http://jsfiddle.net/nxPhy/ - I'm looking for a css way to have the const div always visible regardless of any horizontal scrolling of the parent div (so only the content div is actually scrolled).