Forum Moderators: not2easy

Message Too Old, No Replies

absolute position with top, left, bottom and right

fixed in IE6 (not tested below)

         

Dabrowski

8:40 pm on Apr 21, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have written a script to fix this, it's too big to post here but send me a sticky with your email address if you'd like it.

It's only 1 line of markup required (the <script> in your <head>) and it does the rest for itself.

Supports px, em and % values for edges and margin. Supports px and em for borders.

Xapti

11:14 pm on Apr 21, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There's stuff like this already... but What exactly does this one do? do you mean FIXED positioning?

Dabrowski

11:25 pm on Apr 21, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



No, I've been struggling with DIVs in areas of the screen that have an unknown size.

How do you make 100% work with 10px padding? You can't unless you specify a pixel width, but you can't cos you don't know how big the screen is.

The proper way (I believe as recommended by SuzyUK) would be to do this, imagine you have a 100px header and want the rest of the page to scroll, as in this thread:
[webmasterworld.com...]

Your CSS would be something like:

div {
position: absolute;
top: 100px; left: 0;
bottom: 0; right: 0;
padding: 10px;
overflow: auto;
}

Thus using the top, left, bottom and right properties to stretch the box. Works fine in IE7 and FF, but not in IE6, it only recognises the top and left.

It's a fix for old browsers to accommodate new standards, rather than a fix for new browsers to accommodate old standards, such as my table row height fix.

Xapti

11:38 pm on Apr 21, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Does this have anything to do with IE not counting padding as object size, or something else?

Dabrowski

11:45 pm on Apr 21, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That is a useful side effect if you position DIVs this way.

Xapti

12:44 am on Apr 22, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Cool. I tried out your test page.
So the only problem that's fixed is the bottom and right side's positioning?

In IE6 WITH the fix, the page still doesn't resize dynamically though... isn't that something you'd want? I guess you'd just add the function call to when window is resized, And that will fix things.

Does IE7.js fix this problem too? It's supposed to fix most of IE's bugs... What's it's status now, anyway? it seems like the site hasn't been updated in a long time or something?

[edited by: Xapti at 12:47 am (utc) on April 22, 2007]

Dabrowski

10:06 am on Apr 22, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



So the only problem that's fixed is the bottom and right side's positioning?

Yes, that is the problem with IE6.

In IE6 WITH the fix, the page still doesn't resize dynamically though... isn't that something you'd want?

Didn't really think about it, depends how many people in IE6 will fiddle with their window size while looking at the page.

I guess you'd just add the function call to when window is resized, And that will fix things.

Should do, download the script, add an onResize and let me know.

Does IE7.js fix this problem too? It's supposed to fix most of IE's bugs...

Never heard of it. I tend to write all my own stuff anyway.

Dabrowski

12:19 pm on Apr 22, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Found an interesting side-effect with this....

In FF after specifying edges you can use height/width 100% to fill the space on nested children.

This doesn't work in IE6 or IE7.

However I found that after applying my fix in IE6, width/height 100% then worked on nested children. So have modified script to calculate and add width and height to IE7 so nested sizes then work.

Xapti

7:51 pm on Apr 22, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think I had this problem on a conceptual menu I was trying to create. I thought doing an expression call for IE fixed it, but it turns out it didn't work too well. I wonder if this will fix the problem.

Dabrowski

10:05 pm on Apr 22, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Maybe, I know people have used something like 'width: expression......' for IE, but that is specific to the page and you have to do it every time. This way 1 line of <script> fixes every element, on every page.

It also eliminates the need for faux columns, as your contained DIVs can now use 'height: 100%;'.