老师这写可以吗
来源:4-6 自由编程
慕田峪8130438
2021-03-15 18:43:15
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="css.css">
</head>
<body>
<!-- header页头区域 -->
<header>
<div class="box1">
<!-- logo区域 -->
<h1 class="logo">Career Buider</h1>
<!-- 导航栏区域 -->
<nav>
<ul>
<li><a href=""> HOME</a></li>
<li><a href=""> ABOUT</a></li>
<li><a href=""> GALLERY</a></li>
<li><a href=""> FACULTY</a></li>
<li><a href=""> EVENTS</a></li>
<li><a href=""> CONTACT</a></li>
</ul>
</nav>
</div>
</header>
<!-- banner横幅区域 -->
<div class="banner">
<div><img src="素材/banner3.jpg" alt="sucai"></div>
<div class="box2">banner遮罩层区域</div>
<div class="box3">
<form>
<input type="text" placeholder="your Name">
<input type="text" placeholder="your Phone">
<input type="text" placeholder="your Email">
<textarea cols="30" rows="10" placeholder="Welte Your Conment Here"></textarea>
<input type="submit" value="SEND MESSAGE">>
</form>
</div>
</div>
<!-- about区域 -->
<div>
<div>about上半区域</div>
<div>about下半区域</div>
</div>
<!-- 图片混合区域 -->
<div>
<div>图片1</div>
<div>文字2</div>
<div>图片3</div>
<div>文字4</div>
<div>图片5</div>
<div>文字6</div>
<div>图片7</div>
<div>文字8</div>
</div>
<!-- gallery区域 -->
<div>
<div>gallery上半区域</div>
<dl>
<dt>图片</dt>
<dd>Science Lab</dd>
</dl>
<dl>
<dt>图片</dt>
<dd>Indoor Stadium</dd>
</dl>
<dl>
<dt>图片</dt>
<dd>Transportation</dd>
</dl>
<dl>
<dt>图片</dt>
<dd>Kids Room</dd>
</dl>
<dl>
<dt>图片</dt>
<dd>Meditation Classes</dd>
</dl>
<dl>
<dt>图片</dt>
<dd>Kids Play Ground</dd>
</dl>
</div>
<!-- footre页脚区域 -->
<p>𝕔2016imooc.com京ICP备13046642号</p>
</body>
</html>
问题描述:css
* {
margin: 0;
padding: 0;
}
a {
text-decoration: none;
display: block;
}
header {
height: 80px;
background-color: #07cbc9
}
header .box1 {
width: 1200px;
height: 80px;
overflow: hidden;
margin: 0 auto;
}
.logo {
float: left;
line-height: 80px;
color: #fff;
}
nav {
float: right;
}
nav ul li {
display: inline-block;
line-height: 80px;
font-size: 12px;
list-style: none;
margin-left: 20px;
}
nav ul li a {
color: #fff;
}
.banner {
width: 100%;
height: 600px;
position: relative;
}
[alt] {
width: 100%;
height: 600px;
}
div .box2 {
width: 100%;
height: 600px;
position: absolute;
top: 0;
left: 0;
background: rgba(0, 0, 0, 0.5);
}
div .box3 {
width: 504px;
height: 600px;
position: absolute;
top: 50%;
left: 50%;
margin: -300px 0 0 -252px;
}
form {
width: 504px;
height: 600px;
margin-top: 100px;
}
[type="text"] {
display: block;
width: 502px;
height: 38px;
border: 1px solid #808080;
background: none;
outline: none;
margin-bottom: 20px;
color: #808080;
}
form textarea {
display: block;
width: 502px;
height: 110px;
border: 1px solid #808080;
background: none;
outline: none;
margin-bottom: 25px;
color: #808080;
}
[type="submit"] {
display: block;
width: 200px;
height: 40px;
border: 1px solid #808080;
background: none;
outline: none;
margin: 0 auto;
color: #808080;
}
1回答
好帮手慕久久
2021-03-15
同学你好,效果是对的,有如下问题可优化:
1、提交按钮的后面,多写了一个“>”,建议去除:
2、form表单超出了父元素:
原因是表单的高度与父元素一样,设置margin-top后,会整体下移,所以超出。
建议不给表单设置固定高度,让其高度由内容撑开:
3、图片文件夹,最好改成英文名,比如images,这样更规范:
祝学习愉快!
相似问题