0
0
CSSmarkup~10 mins

Class selectors in CSS - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to select all elements with the class highlight.

CSS
.[1] { color: red; }
Drag options to blanks, or click blank then click option'
A*highlight
B#highlight
Chighlight
Dhighlighted
Attempts:
3 left
💡 Hint
Common Mistakes
Using a hash (#) instead of a dot (.) for class selectors.
Adding extra characters before the class name.
2fill in blank
medium

Complete the code to make text bold for elements with the class bold-text.

CSS
.[1] { font-weight: bold; }
Drag options to blanks, or click blank then click option'
Abold-text
Btext-bold
Cboldtext
Dbold_text
Attempts:
3 left
💡 Hint
Common Mistakes
Using underscores instead of hyphens.
Mixing up the order of words in the class name.
3fill in blank
hard

Fix the error in the class selector to change background color for container class.

CSS
[1]container { background-color: lightblue; }
Drag options to blanks, or click blank then click option'
A#
B.
C*
D:
Attempts:
3 left
💡 Hint
Common Mistakes
Using # instead of . for class selectors.
Omitting the dot before the class name.
4fill in blank
hard

Complete the code to select elements with class menu and set font size to 1.2rem.

CSS
[1]menu { font-size: 1.2rem; }
Drag options to blanks, or click blank then click option'
A.
B#
D:
Attempts:
3 left
💡 Hint
Common Mistakes
Using # instead of .
Adding colon (:) before class name.
5fill in blank
hard

Fill all three blanks to create a CSS rule that selects elements with class btn inside a nav element and sets their color to green.

CSS
[1]nav[2].[3]btn { color: green; }
Drag options to blanks, or click blank then click option'
A>
D+
Attempts:
3 left
💡 Hint
Common Mistakes
Using > or + combinators incorrectly.
Adding spaces between dot and class name.