CSS Borders & Radius
Borders draw the edge; border-radius reshapes it. From hairline dividers to perfect circles and pills, this one property pair carries a surprising share of modern UI.
1. Border basics
hr-card {
border: 2px solid #5A8AB9; /* shorthand */
border-bottom: 4px dashed #E0982D; /* per-side override */
}The style keyword is mandatory — without solid, dashed, dotted or friends, no border renders. Each side can differ, which is how underline-style tabs (border-bottom only) are made.
2. border-radius: from soft to circle
border-radius: 12px; /* soft card */ border-radius: 999px; /* pill button */ border-radius: 50%; /* perfect circle (on a square) */ border-radius: 40px 8px 40px 8px; /* per-corner: leaf shape */
Per-corner values run clockwise from top-left. A radius of at least half the height turns any box into a pill; 50% on a square makes a circle — the standard avatar treatment. Shadows and backgrounds follow the curve automatically.
3. Try it yourself
Turn the square into a circle (border-radius: 50%) and give the button a pill shape with a 2px solid #3E6787 border.
4. Quiz — check your understanding
CSS Borders & Radius Quiz
4 questions · pass at 60%Q1. Which border declaration actually renders?
Q2. How do you make a perfect circle from a square div?
Q3. border-radius: 40px 8px 40px 8px assigns corners in which order?
Q4. Underline-style tabs are usually built with…
Every lesson quiz you pass (60%+) is saved in your browser and counts toward the CSSmatic Certificate of Completion.