RoiEX RoiEX - 6 months ago 20x
HTML Question

Is style="display: list-item;" using an <a> tag inside <ol> "legal"

I just discovered the display: list-item; option in CSS, but I'm not sure on how to use it correclty. It works fine for me in Firefox using

<a href="target.php" style="display:list-item;">TargetLink</a>

But eclipse tells, me that this is not supposed to be used like this (warning: invalid location of tag a)
I tried with out or with a div tag with style="list-style-type: decimal;" instead, but this way every entry is the 0.

How is style="display: list-item;" supposed to be used?


I think you can use display: list-item like this, also only li can be direct children of ul and ol

.item {
  list-style-type: square;
  list-style-position: inside;
<p class="item">Lorem ipsum dolor.</p>
<p class="item">Lorem ipsum dolor.</p>
<div class="random">Lorem ipsum dolor.</div>
<div class="item">Lorem ipsum dolor.</div>