Forum Moderators: not2easy

Message Too Old, No Replies

IE6 <ol> oddity when <li> has "hasLayout"

all are numbered "1"

         

swa66

6:54 pm on Dec 17, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I was playing with a layout that needed for other reasons to hgive layout to the <li>s of a <ol>.

To my surprise IE6 numbered ALL of the <li>s with "1".

Anybody know a solution that does not involve the <li>'s not gaining hasLayout ?

testcase:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>untitled</title>
<style type="text/css">
ol {
background-color: orange;
}
</style>
<!--[if lt IE 7]>
<style type="text/css">
.play li {
zoom:1; /*need hasLayout here*/
}
</style>
<![endif]-->
</head>
<body>
<ol class="play">
<li>one</li>
<li>two</li>
<li>three</li>
</ol>
</body>
</html>

I know IE6 can't do math, but this is way over the top, even for IE6.

alt131

12:38 am on Dec 18, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Set display back to display:list-item.

swa66

1:46 am on Dec 18, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Interesting!

Not quite there yet, but this part is solved at least.

Thanks alt131!

swa66

2:36 am on Dec 18, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Probably very related to the previous, so I'll risk keeping it in the same topic:

IE6 insists on displaying the number on the last line instead of on the first line (when the <li> has gained "hasLayout")

testcase:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>untitled</title>
<style type="text/css">
ol {
background-color: orange;
}
</style>
<!--[if lt IE 7]>
<style type="text/css">
.play li {
zoom:1; /*need hasLayout here*/
display:list-item;
}
</style>
<![endif]-->
</head>
<body>
<ol class="play">
<li>one</li>
<li>2 should be here<br />2 should not be here</li>
<li>three</li>
</ol>
</body>
</html>

I have actually googled for it, found others reporting similar stuff but nothing in the form of a doable workaround.

alt131

2:44 am on Dec 18, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



vertical-align:top

swa66

3:37 am on Dec 18, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I had tried the vertical-align:top on the one I was playing with (not this far simpler demo showing it), unfortunately it doesn't work for the other one.

Thanks anyway for the effort alt131!

alt131

11:35 am on Dec 18, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This is css at a very elementary level - no effort required.

If the purpose of the thread was to improve knowledge or find a solution, try posting example code that reproduces the actual issue. No benefit gained by posting code aware it doesn't expose the real issue - especially when already aware that what will solve the snippet posted will fail for the real issue in real-world code.

In terms of the supposed underlying issue, analysis of content typically reveals <li> issues - especially line-break issues - are produced by semantically incorrect mark-up. Resolve the html semantics rather than expending time looking for solutions to "style issues" created by mis-using style to corect mis-used html.

swa66

5:43 pm on Dec 18, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



FWIW: I was helping somebody and am not allowed to reveal their code, let alone make it public.

The original code validates (using a strict doctype). I'll look at crafting a more complex test case that still fails, need time ...

SuzyUK

10:20 pm on Dec 19, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



this is not CSS at an elementary level IMHO,

No benefit gained by posting code aware it doesn't expose the real issue

it exposes the issue for me..not in IE7 unless you trip quirks mode, but it's very blatant in IE6, and that is after all the title of the post..

.. or alternatively can you explain why changing that display property works (according to specs) - to me, according to specs IS elementary level i.e. it works as you would expect it to if you're learning ;)

[edited by: SuzyUK at 10:38 pm (utc) on Dec. 19, 2008]

SuzyUK

10:29 pm on Dec 19, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm sorry swa you are looking at the "non" logic that is haslayout so I'm afraid there is no logical fix you need to pick the best one for your code/clients support needs..

alt131's solutions are probably the best, at least they are CSS/conditional comment controlled.. and not HTML dependant