CSS to select all li in ul

我与影子孤独终老i 提交于 2019-12-22 05:08:08

问题


I want to write a CSS selector that selects all li elements within a ul element in a document but I don't know how that would be done. Can you help?


回答1:


ul > li {
  /* css styles go here */
}

or

ul li {
  /* css styles go here */
}

the first selects only direct children the second selects all li nested within an ul.




回答2:


This should work:

ul li { /*css here */}



回答3:


You can use

 ul li {
  /* your code here */
 }


来源:https://stackoverflow.com/questions/12464500/css-to-select-all-li-in-ul

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!