How would you style only the first list item of an unordered list in CSS?
- ul li:first-child
- ul li:nth-child(1)
- ul:first-child li
- ul:first-of-type li
To style only the first list item of an unordered list in CSS, you should use the ul li:first-child selector. This targets the first li element within a ul element. It's important to note that :first-child targets the first child of its parent, not the first of its type.
Loading...
Related Quiz
- When using float, what happens to the element's position in the normal document flow?
- The default value of animation-timing-function is ______.
- When you want to generate multiple class or ID variations in SASS, you would typically use ________.
- You need to remove the default bullet points and apply a custom image as the bullet for each list item in an unordered list. How would you achieve this in CSS?
- The CSS property ________ can be used to control the amount of space after each paragraph.