0
0
CSSmarkup~20 mins

Padding in CSS - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Padding Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
📝 Syntax
intermediate
2:00remaining
What is the computed padding for this CSS?
Given the CSS below, what is the total padding applied to the element on the left and right sides combined?

div { padding: 10px 20px 30px 40px; }
CSS
div { padding: 10px 20px 30px 40px; }
A60px
B50px
C30px
D40px
Attempts:
2 left
💡 Hint
Remember the order of padding values: top, right, bottom, left.
🧠 Conceptual
intermediate
1:30remaining
Which padding property sets only the bottom padding?
You want to add space only below an element. Which CSS property should you use?
Apadding-right
Bpadding-left
Cpadding-top
Dpadding-bottom
Attempts:
2 left
💡 Hint
Think about the side of the box you want to add space to.
layout
advanced
2:30remaining
What is the visible width of the box with this CSS?
Consider this CSS and HTML:

div { width: 200px; padding: 10px 15px; border: 5px solid black; box-sizing: content-box; }

What is the total visible width of the div in pixels?
CSS
div { width: 200px; padding: 10px 15px; border: 5px solid black; box-sizing: content-box; }
A230px
B240px
C270px
D250px
Attempts:
2 left
💡 Hint
Remember that with content-box, padding and border add to the width.
accessibility
advanced
1:30remaining
Why is padding important for clickable buttons?
Which reason best explains why adding padding to buttons improves accessibility?
APadding increases the clickable area, making it easier to tap or click.
BPadding hides the button from screen readers.
CPadding changes the button color for better contrast.
DPadding reduces the font size inside the button.
Attempts:
2 left
💡 Hint
Think about how users interact with buttons on different devices.
selector
expert
2:00remaining
Which CSS selector applies padding only to paragraphs inside a section with class 'intro'?
You want to add 20px padding only to <p> elements inside <section class="intro">. Which selector is correct?
Ap.intro section { padding: 20px; }
Bsection > .intro p { padding: 20px; }
Csection.intro p { padding: 20px; }
D.intro > p { padding: 20px; }
Attempts:
2 left
💡 Hint
Think about the order: parent then child in selectors.