作业一
题目:
代码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>游戏罢了</title>
<style>
*{
margin: 0;
padding: 0;
box-sizing:border-box;
}
.container{
height: 60px;
width: 900px;
margin: 0 auto;
background-color: grey;
border-radius: 10%;
}
ul{
height: 100%;
width: 100%;
}
ul li{
height: 100%;
width: 100px;
list-style: none;
background-color: navy;
float: left;
text-align: center;
line-height: 60px;
color: white;
font-weight: 500;
}
ul li:hover{
background-color: red;
cursor:pointer;
}
</style>
</head>
<body>
<div class="container">
<ul>
<li>游戏1</li>
<li>游戏2</li>
<li>游戏3</li>
<li>游戏4</li>
<li>游戏5</li>
<li>游戏6</li>
<li>游戏7</li>
<li>游戏8</li>
<li>游戏9</li>
</ul>
</div>
</body>
</html>
运行结果截图:
题目二 :完成一个网站
代码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>英雄联盟网站</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f8f8f8;
}
header {
background-color: #2c3e50; /* 深蓝色 */
color: #fff;
padding: 20px;
text-align: center;
}
nav {
background-color: #34495e; /* 深灰色 */
color: #fff;
padding: 10px;
text-align: center;
}
nav a {
color: #fff;
text-decoration: none;
padding: 10px;
margin: 0 5px;
}
nav a:hover {
background-color: #2c3e50; /* 深蓝色 */
}
section {
padding: 20px;
}
footer {
background-color: #2c3e50; /* 深蓝色 */
color: #fff;
text-align: center;
padding: 10px;
position: fixed;
bottom: 0;
width: 100%;
}
img {
max-width: 100%;
height: auto;
}
</style>
</head>
<body>
<header>
<h1>欢迎来到英雄联盟网站</h1>
</header>
<nav>
<a href="#news">游戏资讯</a>
<a href="#guides">战术指南</a>
<a href="#community">玩家社区</a>
</nav>
<section id="news">
<h2>游戏资讯</h2>
<p>这里会显示最新的英雄联盟游戏资讯。</p>
<img src="https://img0.baidu.com/it/u=3164165610,2768505946&fm=253&fmt=auto&app=120&f=JPEG?w=1422&h=800" alt="游戏资讯图片">
<p>近期更新包括新英雄发布、游戏赛事动态和版本更新内容。</p>
</section>
<section id="guides">
<h2>战术指南</h2>
<p>这里会提供关于游戏战术和策略的指南。</p>
<img src="https://img2.baidu.com/it/u=4164365539,124870644&fm=253&fmt=auto&app=120&f=JPEG?w=1283&h=361" alt="战术指南图片">
<p>了解如何选择英雄、制定有效的游戏策略以及在比赛中取得胜利。</p>
</section>
<section id="community">
<h2>玩家社区</h2>
<p>在这里,玩家可以分享经验、交流想法,并找到新的队友。</p>
<img src="https://p2.itc.cn/images01/20230627/a56f35a957304d7cb2b1ae78ced8b1fa.png" alt="玩家社区图片">
<p>加入数百万玩家的社区,一起探讨游戏技巧、分享游戏心得,并组建属于你的游戏团队。</p>
</section>
<section id="background">
<h2>游戏背景</h2>
<p>英雄联盟是一个多人在线竞技游戏,玩家将控制一位称为英雄的角色,与其他玩家组成队伍进行对抗。</p>
<p>游戏设定在一个名为符文大陆的幻想世界,玩家可以选择不同的英雄角色,每个角色都有独特的技能和特点。</p>
<p>符文大陆是一个神秘而古老的世界,拥有丰富的历史和传说,吸引着无数冒险者前来探索。</p>
</section>
<section id="heroes">
<h2>英雄介绍</h2>
<p>英雄联盟拥有数百位英雄角色供玩家选择,每个英雄都有自己的故事和背景。</p>
<p>英雄们来自不同的种族和文化,拥有各自独特的技能和战斗风格,玩家可以根据自己的喜好选择适合自己的英雄。</p>
</section>
<section id="gameplay">
<h2>游戏玩法</h2>
<p>英雄联盟是一款团队合作的游戏,玩家需要与队友合作,制定战术并协调行动,才能取得胜利。</p>
<p>游戏分为多种模式,包括经典模式、大乱斗模式等,玩家可以根据自己的喜好选择不同的游戏模式进行游戏。</p>
</section>
<section id="maps">
<h2>游戏地图</h2>
<p>英雄联盟拥有多张地图供玩家游玩,每张地图都有不同的设计和规则。</p>
<p>地图包括召唤师峡谷、水晶之痕、嚎哭深渊等,玩家可以根据自己的喜好选择不同的地图进行游戏。</p>
</section>
<footer>
<p>版权所有 © 2024 英雄联盟网站</p>
</footer>
</body>
</html>
运行结果截图:
登入页面代码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>英雄联盟登入</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f0f0f0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
flex-direction: column;
}
.container {
background-color: #fff;
padding: 20px;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
width: 300px;
display: flex;
flex-direction: column;
align-items: center;
}
.login-form {
display: flex;
flex-direction: column;
width: 100%;
}
.form-group {
margin-bottom: 10px;
width: 100%;
}
label {
font-weight: bold;
}
input[type="text"], input[type="password"] {
padding: 8px;
font-size: 16px;
border: 1px solid #ccc;
border-radius: 4px;
width: calc(100% - 18px);
}
button {
padding: 10px;
font-size: 16px;
background-color: #4CAF50;
color: white;
border: none;
cursor: pointer;
border-radius: 4px;
width: 100%;
}
button:hover {
background-color: #45a049;
}
.hero-logo {
width: 150px; /* adjust the size as needed */
margin-bottom: 20px;
}
h1 {
color: #4CAF50;
}
</style>
</head>
<body>
<div class="container">
<h1>英雄联盟登入</h1>
<img src="https://img1.gamedog.cn/2017/04/17/311-1F41G615510.jpg" alt="英雄联盟" class="hero-logo">
<form action="login.php" method="POST" class="login-form">
<div class="form-group">
<label for="username">账号:</label>
<input type="text" id="username" name="username" required>
</div>
<div class="form-group">
<label for="password">密码:</label>
<input type="password" id="password" name="password" required>
</div>
<button type="submit">登入</button>
</form>
</div>
</body>
</html>
结果展示