Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想编写一个 CSS 选择器来选择文档中 ul 元素中的所有 li 元素,但我不知道该怎么做。你能帮我吗?
ul > li { /* css styles go here */ }
或者
ul li { /* css styles go here */ }
第一个只选择直接子项,第二个选择所有li嵌套在ul.
li
ul
这应该有效:
ul li { /*css here */}
您可以使用
ul li { /* your code here */ }