0
0
CSSmarkup~10 mins

Font size 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 set the font size of the paragraph to 1.5rem.

CSS
p {
  font-size: [1];
}
Drag options to blanks, or click blank then click option'
Alarge
B15px
C150%
D1.5rem
Attempts:
3 left
💡 Hint
Common Mistakes
Using pixels (px) instead of rem for better scalability.
Using keywords like 'large' which are less precise.
2fill in blank
medium

Complete the code to make the heading font size twice the size of the parent element's font size.

CSS
h1 {
  font-size: [1];
}
Drag options to blanks, or click blank then click option'
A2em
B200rem
C2px
D20%
Attempts:
3 left
💡 Hint
Common Mistakes
Using px which is absolute and not relative.
Using rem which is relative to root, not parent.
3fill in blank
hard

Fix the error in the code to correctly set the font size to 18 pixels.

CSS
div {
  font-size: [1];
}
Drag options to blanks, or click blank then click option'
Apx18
B18px
C18
Dsize:18px
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting the unit.
Writing units before the number.
Using invalid property syntax.
4fill in blank
hard

Fill both blanks to set the font size of paragraphs to 120% and headings to 2rem.

CSS
p {
  font-size: [1];
}
h2 {
  font-size: [2];
}
Drag options to blanks, or click blank then click option'
A120%
B1.2em
C2rem
D20px
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up em and rem units.
Using absolute units like px when relative units are better.
5fill in blank
hard

Fill all three blanks to create a CSS rule that sets a class .highlight with font size 1.25rem, line height 1.5, and font weight bold.

CSS
.highlight {
  font-size: [1];
  line-height: [2];
  font-weight: [3];
}
Drag options to blanks, or click blank then click option'
A1.25rem
B1.5
Cbold
Dnormal
Attempts:
3 left
💡 Hint
Common Mistakes
Using units for line height (should be unitless or length).
Using numeric font-weight instead of keywords like 'bold'.