Anne van Kesteren: Weblog 4.2

Weblog on W3C, WHATWG, HTML, CSS, DOM, XML, HTTP and more.

Layout and list items

Now I'm playing with Internet Explorer I discover all kinds of funny things that might help designers, developers and myself. Especially on having layout is opening my eyes. I discovered quite early that you could fix annoying rendering using height:1% and I'm actually almost always using that property in a slightly different way (_height:1%) for my CSS files. However, the concept that was behind it explained in the above mentioned article was not really one I had a clue about.

With some further testing of contenteditable today (see also contentEditable and more on contenteditable), I reached list items. Look at the following document:

<!DOCTYPE html>
<title>Testing layout on list items in Internet Explorer</title>
<style>
 li{border:solid black}
</style>
<div>
 <ol>
  <li>test<br>test</li>
  <li style="height:1%">test<br>test</li>
 </ol>
</div>

For you convenience I also published it online. The placement of the numbers and the numbering of list items is actually dependent on whether or not hasLayout returns true. Fun stuff.

12th July 2005

Browse through posts: main.

Comments

  1. Another side effect. Look at what happens if you assign "layout" to a <ul> element:

    http://dean.edwards.name/my/ul-yuk.html

    Permalink · 2005-07-12 10:31:01 · Dean Edwards

  2. IE decides not to generate P elements in a LI. The developers have chosen to insert a new LI on enter and insert a BR on shift+enter.

    To my mind there must be a way to insert P elements in a List Item. I wrote a small document on how browsers should behave.

    In a few days I will rewrite this document and describe the exact behaviour more precise.

    I am curious what other people think of my idea...

    Permalink · 2005-07-12 10:54:02 · Jorgen Horstink

  3. Hey, that explains the design issue we've had for Snelsite Comments...

    Anne, are you not cringing from all this horror?

    Permalink · 2005-07-12 11:07:14 · Faruk Ateş

  4. It sucks (I mean IE, not your testing). It resets the counter and affect the vertical alignment…

    Permalink · 2005-07-12 11:17:47 · minghong

  5. Thats another example of the layout misconception:

    "If a layout element has contents, the layout of its contents is determined by its bounding rectangle."

    Draw a border around any non-layout ul/ol, and you'll see that the bullets/numbers are outside of the boundary, and clipped when the ul/ol gains layout. Sorry bullets, but that's the mission of "layout".

    A margin-left:1em brings them back into view.

    Permalink · 2005-07-12 11:36:05 · Ingo Chao

  6. For browser-specific tests, is it not possible to include a screenshot? I wouldn't normally mind, but I'm on Linux with no access to IE without a restart (and yes, I've tried Wine; I can't get IE to install on it).

    Permalink · 2005-07-12 18:21:27 · David House

  7. Hey Anne, don't really get it anymore here. Why do you use non-standard markup to demonstrate anything weird? Thanks for clarification ;)

    Permalink · 2005-07-12 19:13:36 · Jens Meiert

  8. The borders are basicly the same as in Mozilla, but the "bullets" are more like this:

       +-------+
    1. | test  |
       | test  |
       +-------+
       | test  |
    1. | test  |
       +-------+

    The placement of the bullet is at the bottom of the list item when it has layout. Any list item that has layout will have the number 1, without affecting the rest of the list. If you would put another list item to the list, it would have the number 3.

    Permalink · 2005-07-12 19:32:32 · zcorpan

  9. Jens, which part is non standard? According to HTML 5 this is correct. And as the parts of that "standard" (it is actually a specification, not a standard; URIs are a standard) I used here are basically what is already implemented (also in Internet Explorer) I do not see any problem.

    Permalink · 2005-07-13 08:21:33 · Anne

  10. Here are some nice tests.

    Why can't some of the IE developers just write sensible information about all this, instead of coming up with groundbreaking ideas?

    Permalink · 2005-07-13 18:30:07 · Krijn Hoetmer

  11. Krijn, the problem is that they really believe it made perfect sense, and we believe that it doesn't.

    This little communication problem will be hopefully one of the first things the WASP is talking about with MS.

    Permalink · 2005-07-13 21:13:15 · Ingo Chao

  12. The following fixes the bug numbering bug in OL for IE6, but not for IE5.5:

    li {width:480px; display:list-item;  }
    

    Does anyone have an improvement on this?

    Permalink · 2005-08-10 02:09:52 · Artie

Comments are closed

Sorry, comments are closed at this time.