Complete the code to set the font size of the paragraph to 1.5rem.
p {
font-size: [1];
}The font-size property sets the size of the text. Using 1.5rem means 1.5 times the root font size, which is a good practice for responsive design.
Complete the code to make the heading font size twice the size of the parent element's font size.
h1 {
font-size: [1];
}px which is absolute and not relative.rem which is relative to root, not parent.The em unit is relative to the font size of the parent element. Setting font-size: 2em; doubles the size relative to the parent.
Fix the error in the code to correctly set the font size to 18 pixels.
div {
font-size: [1];
}Font size values must include units like px for pixels. Just writing 18 is invalid CSS.
Fill both blanks to set the font size of paragraphs to 120% and headings to 2rem.
p {
font-size: [1];
}
h2 {
font-size: [2];
}em and rem units.px when relative units are better.Using 120% increases the font size by 20% relative to the parent. Using 2rem sets the heading size to twice the root font size.
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.
.highlight {
font-size: [1];
line-height: [2];
font-weight: [3];
}This CSS sets the font size to 1.25 times the root font size, line height to 1.5 times the font size for good spacing, and font weight to bold for emphasis.