-3

I need to align an object to the right. I have it working correctly on every browser except IE6. How can I make this work in css? Here's my CSS:

.object {
position:fixed;
right:0;
left:auto;
}

my question is : how can allign an object to right into IE6 with edit css file ?

3
  • Where is the rest? Where is the HTML? Can you construct a demo? position: fixed is not valid in Explorer 6 so you'll need a workaround. Seeing more code would help us to help you.
    – Sparky
    Jan 20, 2013 at 19:44
  • Holy Mother of Coding. IE6? Where did you find a client that still uses that?! Jan 20, 2013 at 19:47
  • 1) i use gwt html is created automatically 2)my minimum request for my web app is IE6 and i need to test with this :( Jan 21, 2013 at 10:46

2 Answers 2

2

As Moose explained, the fixed positioning does not work in IE6. And as he presented, you have to use absolute positioning for IE6.

Better than HTML conditional comment, I would recommend the use of the * html hack to isolate CSS properties which need to be seen only by IE. This is more elegant and allow you to keep your code clean and sorted in a CSS file.

The thing is, if you have .myclass { /* css properties */ } in your stylesheet, and later * html .myclass { /* css properties */ }, the properties that are defined in both blocks will be ignored ignored in the second block by all browsers (that is because the property for the selectors is the same, and it's place after in the file). But Internet Explorer calculates properties differently, and having * html in the selector actually does give it a higher property.

This way, you can have this kind of code:

.myclass {
    position: fixed;
    right: 0;
}

* html myclass {
    /* Only IE */
    position: absolute;
}

The complete work around is explained here.

0

Unfortunately position:fixed isn't recognized in IE6, but there's a fix you can do.

Try adding this to your HTML as a conditional comment.

<!--[if IE 6]>
    html, body {
        height: 100%;   
        overflow: auto; 
        }
    body .object {
        position: absolute;
        bottom: 0;
        }
<![endif]-->

Not the answer you're looking for? Browse other questions tagged or ask your own question.