老师这样写可以吗
来源:4-8 自由编程
慕田峪8130438
2021-03-16 12:46:07
<!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 class="box4">
<div class="about-top">
<h2>ABOUT</h2>
<div class="box5"></div>
<P>borem lpsum is simply dummy text of the printing and typesetting</P>
<P>industry.Lorem Ipsum has been the industry's standard dummy</P>
<P>text ever since the 1500s</P>
</div>
<div class="about-bottom">
<div class="title">
<h2>A WORD</h2>
<h2>ABOUT US</h2>
</div>
<div class="img"><img src="素材/bb3.jpg" alt=""></div>
<div class="box6">
<p>Praesent dignissim viverra est,sed</p>
<p>bibendum ligula congue non Sed</p>
<p>ac nisl et felis gravida commodo?</p>
<p>Suspendisse eget Ulโamcorper</p>
<p>ipsum. Suspendisse diam amet.</p>
<input type="button" value="EXPLORE">
</div>
<div class="box7">
<p class="p1">7000</p>
<div></div>
<p>students</p>
</div>
<div class="box8">
<p class="p1">600</p>
<div></div>
<p>Faculty</p>
</div>
</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;
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;
}
/* about区域 */
.box4 {
width: 1201px;
margin: 0 auto;
}
.box4 .about-top {
text-align: center;
}
.box4 .about-top h2 {
font-size: 32px;
padding-top: 30px;
line-height: 32px;
}
.box4 .about-top .box5 {
width: 60px;
height: 3px;
background-color: #07cbc9;
margin: 20px auto;
}
.box4 .about-top p {
color: gray;
font-size: 14px;
}
.box4 .about-bottom {
width: 1201px;
height: 464px;
overflow: hidden;
position: relative;
}
.box4 .about-bottom .title {
margin-top: 30px;
position: absolute;
top: 0%;
left: 0%;
}
.box4 .about-bottom .img img {
width: 650px;
height: 435px;
float: left;
margin: 30px 0 0 275px;
}
.box4 .about-bottom .box6 {
width: 300x;
float: left;
padding: 20px;
font-size: 18px;
border: 1px solid gray;
background: rgba(255, 255, 255, 0.5);
position: absolute;
top: 50%;
margin: -100px 0 0 0;
}
.box4 .about-bottom .box6 input {
width: 140px;
height: 40px;
background-color: #000000;
color: #fff;
outline: none;
border: 1px solid #000000;
margin-top: 30px;
font-size: 16px;
}
.box4 .about-bottom .box7 {
width: 260px;
height: 100px;
float: right;
margin-top: 20px;
padding: 40px 0;
background: none;
border: 1px solid #07cbc9;
}
.box4 .about-bottom .box7 .p1 {
font-weight: 700;
font-size: 28px;
text-align: center;
}
.box4 .about-bottom .box7 div {
width: 60px;
height: 3px;
background-color: #07cbc9;
margin: 20px auto;
}
.box4 .about-bottom .box7 p {
font-size: 18px;
text-align: center;
}
.box4 .about-bottom .box8 {
width: 260px;
height: 100px;
float: right;
margin-top: 30px;
padding: 40px 0;
background: none;
border: 1px solid #07cbc9;
}
.box4 .about-bottom .box8 .p1 {
font-weight: 700;
font-size: 28px;
text-align: center;
}
.box4 .about-bottom .box8 div {
width: 60px;
height: 3px;
background-color: #07cbc9;
margin: 20px auto;
}
.box4 .about-bottom .box8 p {
font-size: 18px;
text-align: center;
}
1回答
好帮手慕久久
2021-03-16
同学你好,代码中有如下问题可优化:
1、标题下的文字描述,可以放在一个p标签中,然后使用br标签换行:
2、标签最好都写成小写,这样更规范:
3、数字区与图片顶部不对齐:
建议将数字区往下调整一下:
4、.box7、.box8两个盒子的样式是一样的,里面的元素样式也是一样的,而同学将相同的样式写了两遍,代码冗余。建议让二者使用同一套样式,从而复用代码。例如:
5、图片文件夹,最好使用英文名,这样更规范:
祝学习愉快!