how to hide
  • bullets in navigation menu and footer links BUT show them for listing items
  • 前端 未结 7 1893
    后悔当初
    后悔当初 2020-12-09 07:23

    I have a navigation menu, footer, and a slideshow which use listed style to list links and images. I have the css list-style:none; set to hide the bullets next

    7条回答
    •  一个人的身影
      2020-12-09 08:26

      You can style li elements differently based on their class, their id or their ancestor elements:

      li { /* styles all li elements*/
          list-style-type: none;
      }
      
      #ParentListID li { /* styles the li elements that have an ancestor element
                            of id="ParentListID" */
          list-style-type: bullet;
      }
      
      li.className { /* styles li elements of class="className" */
          list-style-type: bullet;
      }
      

      Or, to use the ancestor elements:

      #navigationContainerID li { /* specifically styles the li elements with an ancestor of
                                     id="navigationContainerID" */
          list-style-type: none;
      }
      
      li { /* then styles all other li elements that don't have that ancestor element */
          list-style-type: bullet;
      }
      

    提交回复
    热议问题