Introduction: Are you ready to dive into the world of web development? HTML and CSS are the building blocks of the web, and learning them is the first step towards creating your own website. This detailed guide will walk you through the basics, from setting up your environment to building and styling your first webpage.
Content:
<!DOCTYPE html>
<html>
<head>
<title>My First Webpage</title>
</head>
<body>
<h1>Welcome to My Website</h1>
<p>This is my first webpage.</p>
</body>
</html>
.html
extension.4. Adding CSS to Your HTML
<h1 style=“color: blue;”>Welcome to My Website</h1>
<style>
body {
font-family: Arial, sans-serif;
}
h1 {
color: blue;
}
</style>
External CSS
styles.css
file.<head>
<link rel=”stylesheet” type=”text/css” href=”styles.css”>
</head>
5. Styling Your Webpage with CSS
body{
background-color: #f0f0f0;
}
h1{
color: #333;
}
p{
color: #666;
}
body{
font-family: ‘Helvetica Neue’, sans-serif;
color: #333;
}
h1{
color: #0073e6;
}
body{
margin: 0;
padding: 0;
}
.container{
width: 80%;
margin: 0 auto;
padding: 20px;
}
6. Building a Simple Webpage
<div class=”container”>
<header>
<h1>My First Website</h1>
</header>
<nav>
<ul>
<li><a href=”#”>Home</a></li>
<li><a href=”#”>About</a></li>
<li><a href=”#”>Contact</a></li>
</ul>
</nav>
<main>
<h2>About Me</h2>
<p> This is a section about me.</p>
</main>
<footer>
<p>© 2024 My First Website</p>
</footer>
</div>
header{
background-color: #0073e6;
color: white;
padding: 10px 0;
}
nav ul{
list-style: none;
padding: 0;
}
nav ul li{
display: inline;
margin-right: 10px;
}
nav ul li a{
text-decoration: none;
color: #0073e6;
}
main{
padding: 20px 0;
}
footer{
background-color: #333;
color: white;
text-align: center;
padding: 10px 0;
}
Congratulations on building your first webpage! By understanding the basics of HTML and CSS, you have laid a strong foundation for further learning in web development. Keep practicing and experimenting with new elements and styles to enhance your skills.