Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to select all <p> elements inside a <section>.
CSS
section [1] p { color: blue; } Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '>' selects only direct children, not all nested elements.
Using '+' or '~' selects siblings, not descendants.
✗ Incorrect
The space selector selects all
elements inside a
2fill in blank
mediumComplete the code to select only <li> elements that are direct children of <ul>.
CSS
ul[1]li { font-weight: bold; } Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a space selects all descendants, not just direct children.
Using '+' or '~' selects siblings, not children.
✗ Incorrect
The '>' selector targets only direct children, so only directly inside
- are selected.
3fill in blank
hardFix the error in the selector to select all <input> elements that are immediately preceded by a <label>.
CSS
label[1]input { border: 1px solid red; }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a space selects any descendant, not just immediate siblings.
Using '>' selects children, but input is a sibling here.
✗ Incorrect
The '+' selector selects the next sibling immediately after the first element.
4fill in blank
hardFill both blanks to select all <div> elements that are siblings after a <header>.
CSS
header[1]div[2] { background-color: lightgray; }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '+' selects only the next sibling, not all siblings.
Using '>' selects children, not siblings.
✗ Incorrect
The '~' selector selects all siblings after the header, and the space after div is just part of the selector syntax.
5fill in blank
hardFill all three blanks to create a selector that selects <span> elements inside <article> that are direct children of <section>.
CSS
article[1]section[2]span[3] { color: green; }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '+' or '~' where child or descendant selectors are needed.
Mixing up the order of selectors.
✗ Incorrect
The space selects descendants, '>' selects direct children, and the last space selects descendants again.