ProgrammingBeginner
HTML & CSS: Building Your First Webpage
Create a beautiful, responsive webpage from scratch using HTML and CSS.

4clear steps
Before you begin
- Text editor installed
The walkthrough
Step by step.
01
Step 1 of 4
Basic HTML Structure
Every HTML document starts with a basic structure. Create a file named index.html.
html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My First Webpage</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<h1>Welcome to My Website</h1>
<p>This is my first webpage!</p>
</body>
</html>Field note
- Always include DOCTYPE for proper rendering
- Use semantic HTML elements
02
Step 2 of 4
Adding Content with HTML
HTML provides various elements for different types of content.
html
<header>
<nav>
<ul>
<li><a href="#home">Home</a></li>
<li><a href="#about">About</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
</nav>
</header>
<main>
<section id="home">
<h1>Welcome</h1>
<p>This is the home section</p>
<img src="image.jpg" alt="Description">
</section>
</main>
<footer>
<p>© 2024 My Website</p>
</footer>Field note
- Use semantic tags like header, main, footer
- Always add alt text to images
03
Step 3 of 4
Styling with CSS
Create style.css to make your page beautiful.
css
/* Reset and base styles */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Arial', sans-serif;
line-height: 1.6;
color: #333;
}
/* Header styling */
header {
background: #4a90e2;
color: white;
padding: 1rem 0;
}
nav ul {
display: flex;
list-style: none;
justify-content: center;
gap: 2rem;
}
nav a {
color: white;
text-decoration: none;
}Field note
- Use CSS reset for consistent styling
- Organize CSS with comments
04
Step 4 of 4
Responsive Design
Make your website look good on all devices.
css
/* Mobile-first approach */
.container {
width: 90%;
max-width: 1200px;
margin: 0 auto;
padding: 1rem;
}
/* Tablet and up */
@media (min-width: 768px) {
.container {
padding: 2rem;
}
nav ul {
gap: 3rem;
}
}
/* Desktop */
@media (min-width: 1024px) {
.container {
padding: 3rem;
}
}Field note
- Start with mobile design first
- Test on multiple screen sizes
Guide complete

