我想要一个网站的前端代码
当然,我可以为您提供一个简单的网站前端代码示例。以下是一个基本的 HTML、CSS 和 JavaScript 结合的网站前端代码:
HTML:
<!DOCTYPE html>
<html>
<head>
<title>My Website</title>
<link rel="stylesheet" type="text/css" 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>
<main>
<section>
<h2>About Us</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam vitae tristique felis. Sed sed enim sed nunc lobortis tempus.</p>
</section>
<section>
<h2>Our Services</h2>
<ul>
<li>Web Design</li>
<li>Graphic Design</li>
<li>SEO</li>
</ul>
</section>
</main>
<footer>
<p>© 2021 My Website. All rights reserved.</p>
</footer>
<script src="script.js"></script>
</body>
</html>
CSS(styles.css):
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
}
header, nav, main, footer {
padding: 20px;
}
header {
background-color: #f2f2f2;
}
nav ul {
list-style-type: none;
padding: 0;
margin: 0;
}
nav li {
display: inline;
margin-right: 10px;
}
nav a {
text-decoration: none;
color: #333;
}
nav a:hover {
color: #000;
}
section {
margin-bottom: 20px;
}
footer {
background-color: #f2f2f2;
text-align: center;
font-size: 12px;
}
script {
display: none;
}
JavaScript(script.js):
// 可以在这里添加一些 JavaScript 代码,以实现一些交互功能或其他功能。
这只是一个简单的示例,您可以根据自己的需求进行修改和扩展。希望对您有所帮助
原文地址: http://www.cveoy.top/t/topic/hMqL 著作权归作者所有。请勿转载和采集!