CSS to select all li in ul

2019-06-19 02:46发布

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?

3条回答
淡お忘
2楼-- · 2019-06-19 03:04
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.

查看更多
3楼-- · 2019-06-19 03:04

This should work:

ul li { /*css here */}
查看更多
不美不萌又怎样
4楼-- · 2019-06-19 03:24

You can use

 ul li {
  /* your code here */
 }
查看更多
登录 后发表回答