Why can it set the height, but unlike the
elements, it feels like it is a "semi-inline" (inline: inline[text]-level) element. HTML 4 is described like this:The following elements may also be considered block-level elements since they may contain block-level elements:
This description seems to be saying that <li />
is a "semi-inline" element. Of course, elements similar to <td />
in this list also gave me such doubts. Today I took a look at the default CSS of each browser. The result is this:
Browsers | CSS |
---|---|
IE6/IE7 |
li{display:block; } |
IE8 / Webkit / Firefox / Opera |
li{display:list-item; } |
Here, it’s basically clear. In A-Grade browsers other than IE6/7, it is a "semi-inline" element. When it comes to display:list-item;
, in fact, even though all A-Grade browsers now support it, not many people use it. Why? In fact, it is of no use. In Quirks Mode, PPK says this:
display: list-item
means that the element is displayed as a list-item, which mainly means that it has a bullet in front of it (like an UL), except in IE 5 on Mac where it gets a number (like an OL). The numbers are buggy: all previous LI's in the page count as one, so this example starts with number 5 (the screenshot was made before I inserted my compatibility-LI's).Live example:display: blockdisplay: list-itemdisplay: list-item
Right. In fact, this does not mean much. But it can be regarded as solving one of my doubts. Share it. If you also have such doubts, maybe if a bug or other question arises next time when coding, you will probably be able to respond quickly.