HTML footer
Created By: chatGPT
Creating a footer in HTML is straightforward. A footer usually contains copyright information, contact details, and links to other pages. You can use the
<footer>
element for this purpose. Here’s a simple example of a footer structure:<footer>
<p>© 2023 My Website. All rights reserved.</p>
<p>Contact us: <a href="mailto:info@mywebsite.com">info@mywebsite.com</a></p>
<ul>
<li><a href="/about">About Us</a></li>
<li><a href="/services">Services</a></li>
<li><a href="/contact">Contact</a></li>
</ul>
</footer>
You can further style your footer using CSS to enhance its appearance. For example, you can set a background color, adjust text alignment, and more. Here’s a basic CSS example to style the footer:
footer {
background-color: #333;
color: white;
text-align: center;
padding: 20px;
}
footer a {
color: #00ccff;
text-decoration: none;
}
footer a:hover {
text-decoration: underline;
}
To integrate the HTML and CSS, include the CSS either in the
<head>
of your document or in an external stylesheet. Here’s how to include it in the <head>
:<head>
<style>
footer {
background-color: #333;
color: white;
text-align: center;
padding: 20px;
}
footer a {
color: #00ccff;
text-decoration: none;
}
footer a:hover {
text-decoration: underline;
}
</style>
</head>
Finally, you can place the
<footer>
at the bottom of your HTML document to ensure it stays at the end of your webpage. Here is the complete code combining everything:<html>
<head>
<style>
footer {
background-color: #333;
color: white;
text-align: center;
padding: 20px;
}
footer a {
color: #00ccff;
text-decoration: none;
}
footer a:hover {
text-decoration: underline;
}
</style>
</head>
<body>
<!-- Main content of the website -->
<footer>
<p>© 2023 My Website. All rights reserved.</p>
<p>Contact us: <a href="mailto:info@mywebsite.com">info@mywebsite.com</a></p>
<ul>
<li><a href="/about">About Us</a></li>
<li><a href="/services">Services</a></li>
<li><a href="/contact">Contact</a></li>
</ul>
</footer>
</body>
</html>