My Location

Jan 7, 2009

IE6 absolute positioning attaching all four sides

By my own and other's observations, the following CSS does not work in IE6.

#div1 {
position: absolute;
left: 50px;
top: 50px;
right: 50px;
bottom: 50px;
}

The only alternative I can think of is to position left and top only, and set width and height in a script which handles an onResize event
. Can anyone suggest a less ugly alternative?

2 comments:

  1. This comes close. It's broken in IE7. Apparently you can make the hack specific to IE6 using <!--[if IE 6.0]> but my IE6 is identifying incorrectly for some reason.

    The problem is the top of the box. I thought I could tidy it up using background positioning and a background image, but had no success.

    ReplyDelete
  2. I implemented the onresize handler as I was originally thinking, and it seems to work OK.

    ReplyDelete