|
Getting your Trinity Audio player ready... |
Developing a simple website may be interesting, and using a well-structured HTML/CSS template can make things a lot simple. In this post, we’ll show how to use HTML and CSS to create an amazing website template. To make the topics easier for you to learn and put into practice, we’ll present clear code examples.
HTML Structure
HTML (Hypertext Markup Language) forms the backbone of any website. It defines the structure and content of the web pages. Let’s start by creating a basic HTML structure for our template:
<!DOCTYPE html>
<html>
<head>
<title>Simple Website Template</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<header>
<h1>Welcome to My Website</h1>
</header>
<nav>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Services</a></li>
<li><a href="#">Contact</a></li>
</ul>
</nav>
<section>
<h2>About Me</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
</section>
<footer>
<p>© 2023 My Website. All rights reserved.</p>
</footer>
</body>
</html>
CSS Styling
CSS (Cascading Style Sheets) adds style and visual appeal to the HTML structure. Let’s create a CSS file and link it to our HTML template to define the appearance of various elements:
/* styles.css */
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
}
header {
background-color: #333;
color: #fff;
padding: 20px;
}
nav {
background-color: #666;
color: #fff;
padding: 10px;
}
nav ul {
list-style-type: none;
margin: 0;
padding: 0;
}
nav li {
display: inline;
margin-right: 10px;
}
nav a {
color: #fff;
text-decoration: none;
}
section {
margin: 20px;
}
footer {
background-color: #333;
color: #fff;
padding: 10px;
text-align: center;
}
Explanation:
- The HTML structure consists of a
<header>,<nav>,<section>, and<footer>. - The CSS file,
styles.css, defines the styling for each element. - The
bodyelement sets the font family, margin, and padding. - The
header,nav, andfooterelements define background colors, padding, and text color. - The
navthe element contains an unordered list (<ul>) of navigation links (<a>tags). - The
sectionelement is a container for the main content of the webpage. - The
footerelement provides copyright information and has a centered text alignment.
Conclusion
By following the HTML structure and CSS styling provided in this article, you can create a simple and visually appealing website template. You can further customize the template by adding additional sections, adjusting colors, or incorporating images. HTML and CSS offer endless possibilities for designing websites, and with practice, you can create stunning web pages that meet your specific needs. Happy coding!
Arsalan Malik is a passionate Software Engineer and the Founder of Makemychance.com. A proud CDAC-qualified developer, Arsalan specializes in full-stack web development, with expertise in technologies like Node.js, PHP, WordPress, React, and modern CSS frameworks.
He actively shares his knowledge and insights with the developer community on platforms like Dev.to and engages with professionals worldwide through LinkedIn.
Arsalan believes in building real-world projects that not only solve problems but also educate and empower users. His mission is to make technology simple, accessible, and impactful for everyone.

