Nested list have double bullets. One for the li
and another for the child list.
<ul>
<li>item</li>
<li>item</li>
<li>
<ul>
<li>item</li>
<li>item</li>
<li>item</li>
</ul>
</li>
</ul>
quick hack: remove the list item:
if you don't close the tags the browser will render it correctly, that is without the extra bullet. Note: this is valid html since you don't need to close
<li>
tags.JSFIDDLE with both examples
source: Google
"as opposed to XHTML, even when delivered with the MIME type text/html – allows authors to omit certain tags."
from google:
The nested list should be a child of one of the list items, like so:
This is valid HTML.
Would you mind if I used styles? Updated
Code:
Another method might be running through the list of LI and adding the style by detecting child nodes. Example
Code (HTML is the same):
You can’t do this just in an external style sheet (as I presume you would want to). The reason is that there is no selector in CSS that would pick up those
li
elements that have aul
element as the first child. So your options are (apart from waiting indefinitely until CSS has a “parent selector”...):class
to suchli
elements and use a class selector. This is normally the preferred way.li
elements and handles them, e.g. adding a class to them.style
attribute in thoseli
elements.