Borders, Rounded Corners and Shadows
What Is It?
Borders mark edges, border-radius rounds corners, and box-shadow adds a visual shadow without reserving layout space.
Properties, Tags and Attributes Explained
border: Shorthand for width, style, and color. A border needs a visible style such as solid.border-radius: Rounds corners; 50% creates a circle when width and height are equal.box-shadow: Sets horizontal offset, vertical offset, blur, optional spread, and color.
Each example is a complete HTML page. The CSS is inside the head's style element. Use Try in new tab to edit the CSS or HTML, run your changes, and reset the example.
Example 1: Card outline
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Borders, Rounded Corners and Shadows</title>
<style>
.card { border: 1px solid #94a3b8; border-radius: 12px; padding: 20px; }
</style>
</head>
<body>
<div class="card"><h2>Starter plan</h2><p>A clear, simple card.</p></div>
</body>
</html>Browser preview
What you see: The card has a thin outline and softly rounded corners.
Example 2: Circular badge
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Borders, Rounded Corners and Shadows</title>
<style>
.badge { width: 80px; height: 80px; border-radius: 50%; display: grid; place-items: center; background: #dbeafe; box-shadow: 0 6px 12px #0f172a33; }
</style>
</head>
<body>
<div class="badge">CSS</div>
</body>
</html>Browser preview
What you see: An equal-width and equal-height box becomes a circle with a shadow.
When and Where to Use It
Use borders to separate regions and subtle shadows to suggest elevation for cards or menus.
Common Mistake or Useful Tip
A shadow does not push nearby elements away. Leave enough room so it is not clipped.
Try It Yourself
Change the shadow blur from 12px to 0 and compare its edge.