Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove double bullets in nested list

Nested list have double bullets. One for the li and another for the child list.

example

    <ul>
        <li>item</li>
        <li>item</li>
        <li>
            <ul>
                <li>item</li>
                <li>item</li>
                <li>item</li>
            </ul>
        </li>
    </ul>

like image 895
Yamiko Avatar asked Jul 28 '13 03:07

Yamiko


People also ask

How do I remove a list from nested list?

Remove items from a Nested List. If you know the index of the item you want, you can use pop() method. It modifies the list and returns the removed item. If you don't need the removed value, use the del statement.

Can a list be nested in another list?

A list can contain any sort object, even another list (sublist), which in turn can contain sublists themselves, and so on. This is known as nested list. You can use them to arrange data into hierarchical structures. You can access individual items in a nested list using multiple indexes.


2 Answers

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 a ul element as the first child. So your options are (apart from waiting indefinitely until CSS has a “parent selector”...):

  • Add class to such li elements and use a class selector. This is normally the preferred way.
  • Use JavaScript that recognizes such li elements and handles them, e.g. adding a class to them.
  • Use inline CSS, i.e. style attribute in those li elements.
like image 102
Jukka K. Korpela Avatar answered Oct 28 '22 08:10

Jukka K. Korpela


The nested list should be a child of one of the list items, like so:

<ul>
  <li>item</li>
  <li>item
    <ul>
      <li>item</li>
    </ul>
  </li>
</ul>

This is valid HTML.

like image 22
Niet the Dark Absol Avatar answered Oct 28 '22 07:10

Niet the Dark Absol