Jump into concepts and practice - no test required
or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Recall & Review
beginner
What does the CSS background-position property do?
It sets the starting position of a background image inside an element. You can move the image horizontally and vertically.
Click to reveal answer
beginner
Name two units or keywords you can use with background-position.
You can use keywords like top, center, bottom, left, right, or length units like px, %, em.
Click to reveal answer
beginner
How would you center a background image using background-position?
Use background-position: center; or background-position: 50% 50%; to place the image in the center horizontally and vertically.
Click to reveal answer
beginner
What happens if you use background-position: right bottom;?
The background image will be placed at the bottom right corner of the element.
Click to reveal answer
intermediate
Can background-position accept two values? What do they represent?
Yes, it accepts two values: the first is horizontal position, the second is vertical position. For example, background-position: 20px 30px; moves the image 20 pixels from the left and 30 pixels from the top.
Click to reveal answer
Which CSS property controls where a background image starts inside an element?
Abackground-position
Bbackground-size
Cbackground-repeat
Dbackground-color
✗ Incorrect
background-position sets the starting point of the background image inside the element.
What does background-position: center; do?
APlaces the image at the top left
BPlaces the image in the center horizontally and vertically
CRepeats the image in the center
DRemoves the background image
✗ Incorrect
It centers the background image both horizontally and vertically.
Which of these is a valid background-position value?
Acenter center
Bmiddle middle
Ctop left bottom
Dleft-right
✗ Incorrect
center center is valid. middle middle is not a CSS keyword.
If you want the background image to start 10 pixels from the left and 20 pixels from the top, what is correct?
Abackground-position: 10% 20%;
Bbackground-position: 20px 10px;
Cbackground-position: left 10px top 20px;
Dbackground-position: 10px 20px;
✗ Incorrect
The first value is horizontal (left), the second is vertical (top).
What does background-position: right bottom; do?
APlaces the image at the top right
BPlaces the image at the bottom left
CPlaces the image at the bottom right
DCenters the image
✗ Incorrect
It places the background image at the bottom right corner of the element.
Explain how to use the background-position property to move a background image to the top right corner.
Think about horizontal and vertical keywords.
You got /4 concepts.
Describe the difference between using percentage values and keyword values in background-position.
Consider how the image moves inside the element.
You got /3 concepts.
Practice
(1/5)
1. What does the CSS property background-position control in a webpage?
easy
A. The border style of the element
B. Where the background image is placed inside an element
C. The color of the background
D. The size of the background image
Solution
Step 1: Understand the property purpose
The background-position property sets the location of the background image inside an element.
Step 2: Compare with other properties
Other properties like background-size control size, and background-color controls color, not position.
Final Answer:
Where the background image is placed inside an element -> Option B
Quick Check:
Background position = image placement [OK]
Hint: Background-position sets image location inside element [OK]
Common Mistakes:
Confusing background-position with background-size
Thinking it changes background color
Assuming it controls element borders
2. Which of the following is the correct syntax to set the background image position to the top right corner?
easy
A. background-position: left bottom;
B. background-position: top left;
C. background-position: right top;
D. background-position: center center;
Solution
Step 1: Recall keyword order for background-position
The correct order is horizontal first, then vertical. So top right is incorrect order.
Step 2: Check options carefully
background-position: top left; uses top left, which is vertical then horizontal, so it is incorrect. background-position: right top; uses right top, which is horizontal then vertical, the correct order.
Final Answer:
background-position: right top; -> Option C
Quick Check:
Horizontal then vertical = right top [OK]
Hint: Write horizontal first, then vertical in background-position [OK]
Common Mistakes:
Swapping horizontal and vertical keywords
Using invalid keyword combinations
Forgetting semicolon at end
3. Given the CSS rule:
div { background-image: url('flower.png'); background-position: 50% 100%; }
Where will the background image appear inside the div?
medium
A. At the bottom right corner
B. At the top left corner
C. Centered both horizontally and vertically
D. Centered horizontally and at the bottom vertically
Solution
Step 1: Understand percentage values in background-position
50% means horizontally centered, 100% means vertically at the bottom edge.
Step 2: Match percentages to position
So the image is horizontally centered and vertically aligned at the bottom inside the div.
Final Answer:
Centered horizontally and at the bottom vertically -> Option D
Quick Check:
50% horizontal + 100% vertical = center bottom [OK]
Hint: Percentages: 50% center, 100% bottom [OK]
Common Mistakes:
Mixing up horizontal and vertical order
Assuming 100% means top
Confusing percentages with pixels
4. Identify the error in this CSS snippet:
section { background-position: 20px 30px 40px; }
medium
A. Too many values for background-position
B. Missing units for values
C. Incorrect property name
D. Background image not specified
Solution
Step 1: Check the number of values for background-position
The property accepts one or two values: horizontal and optional vertical. Here, three values are given, which is invalid.
Step 2: Verify other options
Units are present (px), property name is correct, and background image can be set separately, so those are not errors here.
Final Answer:
Too many values for background-position -> Option A
Quick Check:
background-position accepts max 2 values [OK]
Hint: Use max two values: horizontal and vertical [OK]
Common Mistakes:
Adding extra values beyond two
Forgetting units on length values
Confusing property names
5. You want a background image to appear exactly 10px from the left and 20% from the top inside a container. Which CSS rule correctly sets this?
hard
A. background-position: 10px 20%;
B. background-position: 20% 10px;
C. background-position: left 10px top 20%;
D. background-position: 10% 20px;
Solution
Step 1: Understand order of values in background-position
The first value is horizontal (left to right), the second is vertical (top to bottom).
Step 2: Match values to desired position
10px from left means horizontal = 10px; 20% from top means vertical = 20%. So background-position: 10px 20%; is correct.
Final Answer:
background-position: 10px 20%; -> Option A
Quick Check:
Horizontal then vertical = 10px 20% [OK]
Hint: Horizontal first, vertical second in background-position [OK]