html - Scroll page content within specific area? -
I am preparing a website that has fixed elements on the outer edges of the fixed width layout. A devil at the center is reserved for the material.
When the user scrolls, I want to keep all those content (besides fixed external navigation elements) in the boundaries of that center element.
>What I mean is a quick mockup:
I could easily set the overflow property of the center element on auto, and everything remained inside though , It is very important that a scroll bar is not present at the edge of that element.
Actually, I'm wondering how:
- Restrict that content area (maybe I can change the body's size and positioning - is that permission
- Use the Overflow to hide the scroll bar that appears inside the div: Auto
If possible So, you should break your fixed position elements into 4 different parts (top, left, right and bottom). Then just make sure you give the content area pad with their respective widths and heights so that the content does not overlap < / P>
HTML
<4> - Fixed position elements that will overlap your content - & gt; & lt; div id = " gt; & lt; / div & gt; on top & gt; & lt; / div & gt; ;; & Lt; div id = "down" & gt; & lt; / div & gt; & Lt; Div id = "content" & gt; & Lt ;! - Your content - & gt; & Lt; / Div & gt; CSS
html, body {height: 100%; } #top, #left, #wright, #bottom {status: fixed; Left: 0; Top: 0; Z-index: 2; Background: Red; } #top, #bottom {width: 100%; Height: 20px; } #bottom {top: auto; Bottom: 0; } #left, #right {height: 100%; Width: 20px; } #right {left: auto; Correct: 0; } # Content {status: relative; Z-index: 1; Padding: 25px; / * Prevent content due to overlap * /}
You can see it.
Also note that: Relative on the content area. It is so right that the Z-index works correctly and the content is displayed below the defined sections.
If you care for IE6 / 7 support, em> awesome browser.
Comments
Post a Comment