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
Create a Rounded Button with Border Radius
📖 Scenario: You are designing a simple webpage with a button. You want the button to look friendly and smooth by rounding its corners.
🎯 Goal: Build a button with a border radius so its corners are rounded. This will make the button look softer and more modern.
📋 What You'll Learn
Create a button element in HTML
Add a CSS class to style the button
Use the border-radius property in CSS to round the corners
Set the border radius to exactly 12px
Ensure the button has a visible border and background color
💡 Why This Matters
🌍 Real World
Rounded buttons are common in websites and apps to create a friendly and modern look that invites users to click.
💼 Career
Knowing how to style buttons with border-radius is a basic skill for front-end web developers and UI designers.
Progress0 / 4 steps
1
Create the HTML button element
Write an HTML <button> element with the text Click Me inside the <body> tag.
CSS
Hint
Use the <button> tag inside the <body> section with the exact text Click Me.
2
Add a CSS class to the button
Add a class attribute with the value rounded-btn to the existing <button> element.
CSS
Hint
Add class="rounded-btn" inside the <button> tag.
3
Write CSS to round the button corners
Inside a <style> tag in the <head>, write CSS for the class .rounded-btn that sets border-radius: 12px;.
CSS
Hint
Use a <style> tag in the <head> and write .rounded-btn { border-radius: 12px; }.
4
Add border and background color to the button
Inside the existing .rounded-btn CSS, add border: 2px solid #007BFF; and background-color: #E0F0FF; to make the button visible and styled.
CSS
Hint
Add border: 2px solid #007BFF; and background-color: #E0F0FF; inside the .rounded-btn CSS block.
Practice
(1/5)
1. What does the CSS property border-radius do to an element?
easy
A. It makes the corners of the element rounded instead of sharp.
B. It changes the border color of the element.
C. It adds a shadow around the element.
D. It increases the border thickness.
Solution
Step 1: Understand the property purpose
The border-radius property controls the roundness of the corners of an element.
Step 2: Compare options with property effect
Only "It makes the corners of the element rounded instead of sharp." describes making corners rounded, which matches border-radius.
Final Answer:
It makes the corners of the element rounded instead of sharp. -> Option A
Quick Check:
border-radius = rounded corners [OK]
Hint: Remember: radius means roundness, so border-radius rounds corners [OK]
Common Mistakes:
Confusing border-radius with border color or thickness
Thinking it adds shadows
Assuming it changes element size
2. Which of the following is the correct CSS syntax to make all corners of a box have a 10px rounded radius?
easy
A. border-radius: 10;
B. border-radius: 10px, 10px, 10px, 10px;
C. border-radius: 10px 10px 10px 10px 10px;
D. border-radius: 10px;
Solution
Step 1: Recall correct CSS syntax for border-radius
The property accepts one to four length values without commas. For all corners equal, one value is enough.
Step 2: Check each option's syntax
border-radius: 10px; uses one value with unit and no commas, which is correct. border-radius: 10; lacks units, C has too many values, D uses commas which are invalid.
Final Answer:
border-radius: 10px; -> Option D
Quick Check:
One value with unit, no commas = correct syntax [OK]
Hint: Use one value with unit and no commas for all corners [OK]
Common Mistakes:
Omitting units like px
Adding commas between values
Using too many values
3. What will be the visual result of this CSS on a square div?