麻烦老师检查代码
来源:4-6 自由编程
淡淡嚣风
2021-03-07 22:24:27
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="css/css.css">
</head>
<body>
<!-- header区域 -->
<header>
<div class="web">
<div class="logo">Career Builder</div>
<!-- 导航区域 -->
<div class="nav">
<ul>
<li>HOME</li>
<li>ABOUT</li>
<li>GALLERY</li>
<li>FACULTY</li>
<li>EVENTS</li>
<li>CONTACT</li>
</ul>
</div>
</div>
</header>
<!-- banner区域 -->
<div class="banner">
<!-- banner图片 -->
<div class="banner-img"><img src="images/banner3.jpg" alt="">
<!-- banner遮罩层 -->
<div class="banner-mask"></div>
<!-- banner表单 -->
<form action="" method="POST">
<input type="text" placeholder="your Name" class="name">
<input type="text" placeholder="your Phone" class="phone">
<input type="email" placeholder="your Email" class="email">
<textarea placeholder="Write Your Comment Here"></textarea>
<input type="submit" value="SEND MESSAGE" class="send">
</form>
</div>
</div>
</body>
</html>
* {
margin: 0;
padding: 0;
}
li {
list-style: none;
}
header {
background-color: #07cbc9;
height: 80px;
}
header .web {
width: 1200px;
margin: 0 auto;
}
header .logo {
float: left;
height: 40px;
margin-top: 16px;
color: white;
font-size: 20px;
text-align: center;
line-height: 40px;
}
header .nav li {
float: right;
margin-top: 16px;
font-size: 16px;
text-align: center;
margin-left: 20px;
color: white;
line-height: 40px;
}
.banner .banner-img {
position: relative;
width: 100%;
height: 600px;
}
.banner .banner-img img {
width: 100%;
height: 600px;
}
.banner .banner-img .banner-mask {
position: absolute;
background: rgba(0, 0, 0, .5);
width: 100%;
height: 600px;
top: 0;
left: 0;
}
.banner form input,
textarea {
position: absolute;
display: block;
top: 0;
left: 0;
width: 504px;
height: 40px;
background: none;
left: 50%;
margin-left: -252px;
margin-top: 100px;
outline: none;
border: 1px solid #808080;
color: #808080;
}
.banner form .phone {
top: 60px;
}
.banner form .email {
top: 120px;
}
.banner form textarea {
top: 180px;
height: 110px;
}
.banner form .send {
top: 310px;
width: 200px;
text-align: center;
left: 50%;
margin-left: -100px;
}
相关截图:

1回答
同学你好,关于同学的代码问题如下:
1、顶部右侧的导航文字没有垂直居中显示

建议参考如下修改:

2、banner上的表单元素没有实现垂直居中显示

建议参考如下修改:


备注:form标签选择器中的红色背景色需要删除,这里老师用来测试的。
祝学习愉快!
相似问题