使用html5+css3写一个页面
时间: 2024-05-13 10:20:57 浏览: 94
html5+css3页面布局.zip
由于我是AI语言模型,无法实际编写页面,但我可以提供一个HTML5和CSS3的示例代码,以供参考。
HTML5示例代码:
```
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>My Webpage</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<header>
<h1>Welcome to My Webpage</h1>
<nav>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
</ul>
</nav>
</header>
<main>
<section>
<h2>About Me</h2>
<p>Hi, my name is John and I am a web developer. I love creating beautiful and functional websites using HTML, CSS and JavaScript.</p>
<p>On this website, you will find some of my projects and some helpful tips and tutorials to help you improve your web development skills.</p>
</section>
<section>
<h2>My Projects</h2>
<ul>
<li>
<h3>Project 1</h3>
<p>Description of Project 1</p>
</li>
<li>
<h3>Project 2</h3>
<p>Description of Project 2</p>
</li>
<li>
<h3>Project 3</h3>
<p>Description of Project 3</p>
</li>
</ul>
</section>
<section>
<h2>Contact Me</h2>
<form>
<label for="name">Name:</label>
<input type="text" id="name" name="name" required>
<label for="email">Email:</label>
<input type="email" id="email" name="email" required>
<label for="message">Message:</label>
<textarea id="message" name="message" required></textarea>
<button type="submit">Send Message</button>
</form>
</section>
</main>
<footer>
<p>© 2021 My Webpage. All rights reserved.</p>
</footer>
</body>
</html>
```
CSS3示例代码:
```
/* Reset CSS */
html, body, header, main, footer, h1, h2, h3, p, ul, li, a, form, label, input, textarea, button {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* Global Styles */
body {
font-family: sans-serif;
color: #333;
background-color: #f2f2f2;
line-height: 1.5;
}
a {
color: #007bff;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
header {
background-color: #fff;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
padding: 1rem;
}
h1 {
font-size: 2rem;
margin-bottom: 1rem;
}
nav ul {
list-style: none;
display: flex;
justify-content: space-between;
}
nav li {
margin-right: 1rem;
}
nav a {
padding: 0.5rem;
}
main {
padding: 2rem;
}
section {
margin-bottom: 2rem;
}
h2 {
font-size: 1.5rem;
margin-bottom: 1rem;
}
ul {
list-style: none;
}
li {
margin-bottom: 1rem;
}
h3 {
font-size: 1.25rem;
margin-bottom: 0.5rem;
}
form {
display: flex;
flex-direction: column;
}
label {
margin-bottom: 0.5rem;
}
input, textarea {
margin-bottom: 1rem;
padding: 0.5rem;
border: 1px solid #ccc;
border-radius: 4px;
}
button {
padding: 0.5rem;
background-color: #007bff;
color: #fff;
border: none;
border-radius: 4px;
cursor: pointer;
}
button:hover {
background-color: #0069d9;
}
footer {
background-color: #333;
color: #fff;
padding: 1rem;
text-align: center;
}
```
阅读全文