Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Use <code>overflow-y</code> and absolute positioning to emulate fixed positioning in IE6 using the following steps:</p> <ol> <li><p>Create an absolutely positioned div and give it the desired top and left coordinates on the page</p></li> <li><p>Set <code>html {overflow-y: }</code> to be hidden or visible instead of the default auto or scroll to eliminate the scrollbar for the absolutely positioned div</p></li> <li><p>Set <code>body{overflow-y: }</code> to be auto or scroll to insert a new scrollbar for the body content</p></li> <li><p>Set <code>body { margin:0; height:100% }</code> to make sure the content scrollbar goes the length of the page</p></li> <li><p>Set top and left margins on the body to separate the content from the absolutely positioned div </p></li> <li><p>Make sure the doctype is set to trigger Standards Mode in IE</p></li> <li><p>Set the absolutely positioned div to <code>top:50%; left:50%;</code></p></li> <li><p>Add <code>position:relative</code> and the desired opacity to the container div</p></li> </ol> <p>If the doctype is not set, move the html rules to the body tag, and the body rules to a wrapper div</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;style&gt; body { margin:0; margin-left: 14em; } #fixedbox { position: fixed; top: 1em; left: 1em; width: 10em; } #fixedbox { padding: 0.5em; border: 1px solid #000; } #container { height: 2000px; } @media, { html { _overflow-y: visible; *overflow-y: auto; } body { _overflow-y: auto; _height: 100%; } #container { _position: relative; } #fixedbox { _position: absolute; _top:50%; _left: 50%; } } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="container"&gt; Fixed box &lt;/div&gt; &lt;div id="fixedbox"&gt; Homer &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload