0
0
CSSmarkup~10 mins

ID 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 an element with the ID "header".

CSS
#[1] { color: blue; }
Drag options to blanks, or click blank then click option'
A.header
Bheader
Cheader1
Dmain
Attempts:
3 left
💡 Hint
Common Mistakes
Using a dot (.) instead of a hash (#) for ID selectors.
Misspelling the ID name.
2fill in blank
medium

Complete the code to change the background color of the element with ID "main-content".

CSS
#[1] { background-color: lightgray; }
Drag options to blanks, or click blank then click option'
Amain-content
Bcontent-main
Cmaincontent
Dcontent
Attempts:
3 left
💡 Hint
Common Mistakes
Using a similar but incorrect ID name.
Forgetting the hyphen (-) in the ID.
3fill in blank
hard

Fix the error in the CSS selector to style the element with ID "footer".

CSS
[1]footer { font-size: 1.2rem; }
Drag options to blanks, or click blank then click option'
A*
B.
C#
D@
Attempts:
3 left
💡 Hint
Common Mistakes
Using a dot (.) instead of a hash (#) for ID selectors.
Using invalid symbols like * or @.
4fill in blank
hard

Fill both blanks to select the element with ID "nav" and set its text color to red.

CSS
[1][2] { color: red; }
Drag options to blanks, or click blank then click option'
A#
B.
Cnav
Dheader
Attempts:
3 left
💡 Hint
Common Mistakes
Using a dot (.) instead of a hash (#).
Using the wrong ID name.
5fill in blank
hard

Fill all three blanks to select the element with ID "sidebar", set its width to 250px, and add a border.

CSS
[1][2] { width: [3]; border: 1px solid black; }
Drag options to blanks, or click blank then click option'
A#
Bsidebar
C250px
D.
Attempts:
3 left
💡 Hint
Common Mistakes
Using a dot (.) instead of a hash (#) for ID selector.
Forgetting units for width value.