美化一下刚才的网页
时间: 2023-10-21 08:14:43 浏览: 33
好的,以下是一个美化后的赏析古诗的网页代码,您可以参考修改和完善。
HTML代码:
```
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>古诗赏析</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<header>
<h1>古诗赏析</h1>
</header>
<main>
<form>
<label for="poem">请选择一首古诗:</label>
<select name="poem" id="poem">
<option value="1">静夜思</option>
<option value="2">登鹳雀楼</option>
<option value="3">春晓</option>
</select>
<button type="submit">查看赏析</button>
</form>
<div id="analysis"></div>
</main>
<footer>
<p>© 2021 古诗赏析</p>
</footer>
<script src="script.js"></script>
</body>
</html>
```
CSS代码:
```
/* Reset */
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
/* Body */
body {
font-family: Arial, Helvetica, sans-serif;
background-color: #f2f2f2;
}
/* Header */
header {
background-color: #333;
color: #fff;
padding: 20px;
text-align: center;
}
h1 {
font-size: 36px;
margin: 0;
}
/* Main */
main {
max-width: 800px;
margin: 50px auto;
padding: 0 20px;
}
form {
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: 50px;
}
label {
font-size: 20px;
margin-bottom: 10px;
}
select {
font-size: 20px;
padding: 10px;
border-radius: 5px;
}
button {
font-size: 20px;
padding: 10px 20px;
border-radius: 5px;
background-color: #4CAF50;
color: #fff;
border: none;
cursor: pointer;
transition: background-color 0.3s ease;
}
button:hover {
background-color: #3e8e41;
}
#analysis {
background-color: #fff;
padding: 20px;
border-radius: 5px;
text-align: center;
}
h2 {
font-size: 24px;
margin-bottom: 10px;
}
p {
font-size: 20px;
line-height: 1.5;
}
/* Footer */
footer {
background-color: #333;
color: #fff;
padding: 10px;
text-align: center;
}
footer p {
margin: 0;
font-size: 16px;
}
```
JavaScript代码与之前的相同。
在这个版本中,我们使用了CSS来美化页面。我们添加了一个header和footer,分别用于显示网站的标题和版权信息。我们还使用了颜色、字体、边距和过渡等CSS属性来提升页面的可读性和美观度。