Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to select all paragraphs with class highlight.
CSS
p[1]highlight { color: red; } Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using
# which selects by ID, not class.Using
: which is for pseudo-classes.✗ Incorrect
The dot
. is used to select elements by class in CSS.2fill in blank
mediumComplete the code to make the color style more specific for the element with ID title.
CSS
#[1] { color: blue; }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a tag name instead of the ID name.
Confusing class selectors with ID selectors.
✗ Incorrect
The ID selector uses a hash
# followed by the exact ID name.3fill in blank
hardFix the error in the selector to increase specificity for a button inside a form with class submit.
CSS
form[1]submit button { background-color: green; } Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using
#submit which selects by ID, not class.Using combinators like
> or + incorrectly.✗ Incorrect
To select elements by class, use a dot
. before the class name.4fill in blank
hardFill both blanks to select all li elements inside an unordered list with class menu that are direct children.
CSS
ul[1]menu [2] li { font-weight: bold; }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using space instead of
> selects all descendants, not just direct children.Using
# instead of . for class.✗ Incorrect
Use
. to select by class and > to select direct children.5fill in blank
hardFill both blanks to select all input elements inside a form with ID login that have class required.
CSS
form[1]login input[2]required { border: 2px solid red; }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using dot instead of hash for ID.
Using combinators incorrectly between elements.
Forgetting to use dot for class.
✗ Incorrect
Use
# for ID, space for descendant, and . for class selectors.