Which of the following is the correct way to change the text color to red in CSS?
A
color: red; B
text-color: red; C
font-color: red; D
text: red;
Analysis & Theory
`color: red;` is the correct CSS property for changing text color.
What does `margin: 20px;` do?
A
Sets 20px margin on all four sides B
Sets padding to 20px C
Sets width to 20px D
Sets height to 20px
Analysis & Theory
`margin: 20px;` applies 20 pixels of margin on all sides (top, right, bottom, left).
Which unit is relative in CSS?
A
px B
cm C
em D
mm
Analysis & Theory
`em` is a relative unit based on the font size of the element.
What is the default `position` value of an HTML element in CSS?
A
relative B
fixed C
absolute D
static
Analysis & Theory
By default, HTML elements have `position: static`.
Which CSS property controls the size of text?
A
font-size B
text-size C
size D
font-style
Analysis & Theory
`font-size` is used to set the size of the text in CSS.
Which of the following is used for making text bold in CSS?
A
text-weight: bold; B
font-style: bold; C
font-weight: bold; D
text-bold: true;
Analysis & Theory
`font-weight: bold;` is the correct way to make text bold.
What is the correct syntax to apply a background color in CSS?
A
background: red; B
bgcolor: red; C
color-background: red; D
background-color = red;
Analysis & Theory
`background: red;` or `background-color: red;` are correct; the first is more shorthand.
Which property is used to hide an element in CSS?
A
visibility: hidden; B
display: block; C
opacity: 0; D
position: none;
Analysis & Theory
`visibility: hidden;` hides the element but still takes up space.
What does `z-index` control in CSS?
A
Font size B
Element stacking order C
Line height D
Box shadow
Analysis & Theory
`z-index` defines the stack order of overlapping elements.
Which selector selects all `<p>` elements inside a `<div>`?
A
div p B
p div C
div > p D
div + p
Analysis & Theory
`div p` selects all `<p>` elements that are **descendants** of `<div>`.