The pseudo-class :________ is used to target elements that are the only child of its parent with a specific type.
- first-of-type
- last-child
- only-child
- only-of-type
The correct answer is 'only-child'. This pseudo-class selects elements that are the only child of their parent. It ensures that the style is applied to elements that are the sole child within their parent container, regardless of their element type.
Loading...
Related Quiz
- A team is working on a large web application and decides to adopt a CSS methodology to maintain consistency and scalability. Which methodology would be most beneficial for a project where modular and reusable components are a priority?
- How does the @page rule in CSS for Print influence the printed content?
- You are designing a webpage for a vintage-themed site and want to use a cursive style for headings. Which CSS property-value combination will you use?
- What does the flex-wrap property control in a flex container?
- Which CSS property is used to change the text color of an element?