To apply the HTML concepts learned, let’s create a simple web page that incorporates various HTML elements and features. Here’s an example of how you can apply these concepts:
“`html
<!DOCTYPE html>
<html lang=”en”>
<head>
<meta charset=”UTF-8″>
<meta name=”viewport” content=”width=device-width, initial-scale=1.0″>
<title>My Awesome Website</title>
<style>
/* CSS Styles */
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f0f0f0;
}
header {
background-color: #333;
color: #fff;
padding: 10px;
text-align: center;
}
nav {
background-color: #666;
color: #fff;
padding: 10px;
}
nav ul {
list-style-type: none;
padding: 0;
text-align: center;
}
nav ul li {
display: inline;
margin-right: 10px;
}
section {
padding: 20px;
}
article {
background-color: #fff;
padding: 20px;
margin-bottom: 20px;
}
footer {
background-color: #333;
color: #fff;
padding: 10px;
text-align: center;
}
</style>
</head>
<body>
<header>
<h1>Welcome to My Awesome Website</h1>
</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>
<section id=”home”>
<article>
<h2>Home</h2>
<p>Welcome to my website! This is the homepage.</p>
<img src=”images/home.jpg” alt=”Home Image”>
</article>
</section>
<section id=”about”>
<article>
<h2>About</h2>
<p>This is the about page. Learn more about me here.</p>
</article>
</section>
<section id=”contact”>
<article>
<h2>Contact</h2>
<p>Contact me via email: <a href=”mailto:[email protected]”>[email protected]</a></p>
</article>
</section>
<footer>
<p>© 2024 My Awesome Website</p>
</footer>
</body>
</html>
“`
In this example:
– We’ve created a basic HTML structure with `<header>`, `<nav>`, `<section>`, `<article>`, and `<footer>` elements.
– Applied CSS styles to format and style different sections of the web page.
– Included links in the navigation bar (`<nav>`) to navigate to different sections of the page using anchor tags (`<a>`).
– Added images (`<img>`) to the homepage (`<section id=”home”>`) to enhance visual appeal.
– Used semantic HTML elements and attributes to provide structure and meaning to the content.
– Included a contact email link using the `mailto:` scheme.
Feel free to customize this template further and add more HTML elements and features as needed for your own project.