RoiEX RoiEX - 2 years ago 65
HTML Question

Is it valid to set "display: list-item" on <a> tag inside <ol>?

I just discovered the

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

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

But Eclipse tells me that it is not supposed to be used like that (warning: invalid location of tag a)

I tried without
or with a
tag with
style="list-style-type: decimal;"
instead, but this way every entry is the

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

Answer Source

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>

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download