This SSCCE works fine in all browsers from IE6 and up (IE6/7/8, FF2/3, Safari3, Chrome4, Opera9).
<!doctype html>
<html lang="en">
<head>
<title>SO question 2401705</title>
</head>
<body>
<ol>
<li>Item 1
<li>Item 2
</ol>
</body>
</html>
It even works when I tried to replace the </ol>
by the syntactically invalid <ol>
. So, your problem lies somewhere else. You really need to elaborate the "Doesn't work" in more detail. What exactly happens? What exactly happens not? Preferably edit your question to include an SSCCE (like above) and try to ask the question the smart way.
Note, in contrary to what others say, a non-closing <li>
is syntactically valid in normal HTML. It's indeed invalid in XHTML, but I don't see any reason to use XHTML unless you're using a component based MVC framework or some other XML based tool to generate HTML pages.
Update: you thus don't see the numbers. Apparently you've set the margin
of the ol
to zero. This way they will get out of the view. The following SSCCE demonstrates it. It indeed fails in IE6/7.
<!doctype html>
<html lang="en">
<head>
<title>SO question 2401705 - IE6/7 problem</title>
<style>ol { margin: 0; }</style>
</head>
<body>
<ol>
<li>Item 1
<li>Item 2
</ol>
</body>
</html>
Don't set the margin to 0. This may also be caused by a so-called CSS reset sheet. Don't use them, just remember to specify the margins for all block elements yourself.