SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    chown linux:users\ /world Hartmann's Avatar
    Join Date
    Aug 2000
    Location
    Houston, TX, USA
    Posts
    6,455
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)

    Fixed position properties in IE

    I am trying to put a fixed div on the left side of my page with the following CSS:

    Code:
    p {
    margin-left: 30%
    }
    .leftBox {
    position: fixed;
    top: 0px;
    left: 0px;
    padding: 10px;
    margin: 5px;
    background-color: #ccc;
    border: 1px solid #000;
    width: 20%;
    }
    I have a lot of text in the body and when I scroll down the fixed thing works just in Mozilla Firebird (of course) but in IE it knocks my text down and puts white space above where the leftbox is. Any ideas on how to make it degrade better?

  2. #2
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,481
    Mentioned
    182 Post(s)
    Tagged
    6 Thread(s)
    Hi,

    I think the best you can do is to give IE position absolute then use the child selector (which ie doen't understand) to give Mozilla position fixed.

    e.g.
    Code:
    p {
    margin-left: 30%
    }
    .leftBox {
    position: absolute;
    top: 0px;
    left: 0px;
    padding: 10px;
    margin: 5px;
    background-color: #ccc;
    border: 1px solid #000;
    width: 20%;
    }
    html>body .leftBox{position:fixed}
    Hope this helps.

    Paul

  3. #3
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Here's a workaround to use Fixed positioning in IE/Windows. IE/Mac does understand fixed positioning just fine by default.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •