HTML Css Basics
HTML Css Basics
1
2. CSS: Styling the Web
CSS (Cascading Style Sheets) is used to describe the presentation of a document
written in HTML.
2
border: 5px solid black;
margin: 20px;
}
3
}
header {
background-color: #f4f4f4;
padding: 1rem;
text-align: center;
}
.container {
display: flex;
justify-content: space-between;
margin-top: 20px;
}
.box {
background-color: #ddd;
border: 1px solid #999;
padding: 10px;
width: 30%;
}
@media screen and (max-width: 600px) {
.container {
flex-direction: column;
}
.box {
width: 100%;
margin-bottom: 10px;
}
}
</style>
</head>
<body>
<header>
<h1>Welcome to My Web Page</h1>
</header>
<main>
<section class="container">
<div class="box">
<h2>Box 1</h2>
<p>This is the content for box 1.</p>
</div>
<div class="box">
<h2>Box 2</h2>
<p>This is the content for box 2.</p>
</div>
<div class="box">
<h2>Box 3</h2>
<p>This is the content for box 3.</p>
</div>
4
</section>
</main>
</body>
</html>
This example demonstrates a responsive layout using flexbox, with media queries
for mobile devices. It showcases the structure provided by HTML and the styling
capabilities of CSS.