CSS (Text, Borders, and Images) 3 — Questions and Answers
Question 1: Which property aligns text horizontally within its container?
- text-align (Correct answer)
- vertical-align
- align-text
- text-justify
Correct answer: text-align
text-align controls horizontal alignment of inline content.
Question 2: What does 'background-size: cover' do?
- Scales the image to fill the container, cropping if needed (Correct answer)
- Repeats the image to cover the area
- Shrinks the image to fit fully inside
- Centers the image without scaling
Correct answer: Scales the image to fill the container, cropping if needed
cover scales the image to completely fill the box, cropping overflow.
Question 3: Which value of border-style draws two parallel lines?
- double (Correct answer)
- groove
- ridge
- dashed
Correct answer: double
double renders the border as two solid lines.
Question 4: How do you add a shadow to text?
- text-shadow (Correct answer)
- box-shadow
- font-shadow
- shadow-text
Correct answer: text-shadow
text-shadow applies a shadow effect to text.
Question 5: Which property controls whether a border is shown only on the bottom?
- border-bottom (Correct answer)
- border-down
- border-base
- bottom-border
Correct answer: border-bottom
border-bottom sets the border on the bottom edge only.
Question 6: What does 'text-decoration: line-through' produce?
- A strikethrough line over the text (Correct answer)
- An underline
- An overline
- A dotted underline
Correct answer: A strikethrough line over the text
line-through draws a line through the middle of the text.
Question 7: Which property positions a background image within its element?
- background-position (Correct answer)
- background-align
- background-place
- background-offset
Correct answer: background-position
background-position sets where the image is placed in the box.
Which property aligns text horizontally within its container?