fixed divs

I'm sure this has been asked many times, but:

how you do fix a div so that it doesn't scroll with the rest of the page (and everything else scrolls underneath it)?

Many thanks, Nicholas Hill#myDIV {
position: fixed;
top: 50px;
left:50px;
}


Note that it doesn't work in Internet Explorer.Thank you. No wonder I couldn't get it to work ...You're welcome. If you're using a proprietary markup translator (<!-- m --><a class="postlink" href="http://www.microsoft.com/ie">http://www.microsoft.com/ie</a><!-- m -->), I'd suggest you get a real browser (<!-- m --><a class="postlink" href="http://www.mozilla.org/firefox/">http://www.mozilla.org/firefox/</a><!-- m -->) and browse happy (<!-- m --><a class="postlink" href="http://www.browsehappy.com/">http://www.browsehappy.com/</a><!-- m -->). ;)I could use an alternative; the snag is that over 90% of my site visitors use IE. Therefore I code for IE since my vistors use it.Depends on what you are trying to achieve.

I don't think in IE that you can hold a div in a fixed position with respect to the client window (as opposed to the BODY element) without some javascript.

If you have some content that users will scroll through, then you could look at putting that content in a separate IFRAME or a separate DIV that has overflow:auto set, so that BODY does not scroll.Baconbutty is right. You could use JavaScript, but should not require it; is it 100% necessary that the DIV float over the rest of the page, or do you just "need" it to? If it's not required for any reason, JavaScript may be a practical solution.many thanks for yr replies- it's not 100% necessary, but thought it wd be nice to try - then found it didn't work ...I'd apologize, but Internet Explorer is at fault here.
 
Back
Top