Adding Padding to a Box
📖 Scenario: You are creating a simple webpage with a colored box. You want to add space inside the box around the text so it looks neat and not cramped.
🎯 Goal: Build a webpage with a colored box that has padding inside it. The padding should create space between the box border and the text inside.
📋 What You'll Learn
Create an HTML structure with a
<div> element containing text.Add a CSS rule to select the box by its class.
Add padding of
2rem inside the box using CSS.Use semantic HTML and include basic meta tags for accessibility and responsiveness.
💡 Why This Matters
🌍 Real World
Padding is used in web pages to create space inside elements so content looks neat and is easy to read.
💼 Career
Web developers use padding to improve the design and user experience of websites by controlling spacing inside elements.
Progress0 / 4 steps