麻烦老师检查下作业,谢谢
来源:4-8 自由编程
叫我丽红
2021-04-19 11:17:23
相关代码:
html:
<!-- about区域 -->
<div class="about">
<div class="box1">
<h2>about</h2>
<hr>
<p>lorem lpsum is simply dummy text of the printing and typesetting industry. Lorem lpsum has been the industry's standard dummy text ever since the 1500s.</p>
</div>
<div class="box2">
<div class="detail">
<h2>A WORD ABOUT US</h2>
<div class="left-text">
<p>Praesent dignissim viverra es ,sedbibendum ligula congue non Sedac nisl et felis gravida commodo?Suspendisse eget ullamcorper ipsum. Suspendisse diam amet.</p>
<a href="">EXPLORE</a>
</div>
<img src="images/bb3.jpg" alt="">
<div class="right-text">
<div class="stu">
<p>70000</p>
<hr>
<p>Students</p>
</div>
<div class="fac">
<p>600</p>
<hr>
<p>Faculty</p>
</div>
</div>
</div>
</div>
</div>
相关代码:css
/* about区域 */
.about{
width: 1200px;
height: 600px;
margin: 0 auto;
}
.about .box1 h2{
font-size: 32px;
text-align: center;
}
.about .box1 hr{
width: 60px;
height: 3px;
background-color: #07cbc9;
margin: 10px auto;
}
.about .box1 p{
color: gray;
text-align: center;
font-size: 14px;
width: 502px;
margin: 0 auto;
}
.box2 .detail{
width: 1201px;
height: 464px;
position: relative;
}
.box2 .detail h2{
width: 200px;
position: absolute;
left:0;
top: 30px;
}
.box2 .detail .left-text{
float: left;
}
.box2 .detail .left-text p{
width: 300px;
height: 200px;
padding: 20px;
font-size: 18px;
border: 1px solid gray;
background-color:rgba(255.255.255.0.5);
position: absolute;
top: 130px;
left: 0;
}
.box2 .detail .left-text a{
width: 140px;
height: 40px;
margin-bottom: 20px;
background-color: BLACK;
color: white;
font-weight: bold;
text-decoration: none;
position: absolute;
top: 300px;
left: 0;
text-align: center;
margin-top: 10px;
margin-left: 20px;
}
.box2 .detail img{
width: 650px;
height: 435px;
margin-top: 30px;
margin-left:250px;
}
.box2 .detail .right-text .stu{
float: right;
width: 260px;
border: 1px solid #07cbc9;
padding: 40px 0;
position: absolute;
right: 0;
top: 0;
margin-top: 30px;
}
.box2 .detail .right-text .stu hr{
width: 60px;
height: 3px;
background-color: #07cbc9;
margin: 5px auto;
}
.box2 .detail .right-text .stu p{
font-size: 28px;
text-align: center;
}
.box2 .detail .right-text .fac{
float: right;
width: 260px;
border: 1px solid #07cbc9;
padding: 40px 0;
position: absolute;
right: 0;
top: 0;
margin-top: 230px;
}
.box2 .detail .right-text .fac hr{
width: 60px;
height: 3px;
background-color: #07cbc9;
margin: 5px auto;
}
.box2 .detail .right-text .fac p{
font-size: 28px;
text-align: center;
}
1回答
好帮手慕星星
2021-04-19
同学你好,代码布局是可以的,但是样式上还需要完善:
1、hr元素默认有边框,看着不美观

可以去掉

2、左侧内容需要有背景色

代码中没有设置成功,是因为不同颜色值之间用逗号隔开,不是点隔开。修改

3、EXPLORE按钮中文字没有垂直居中显示

可以设置行高与高度相等实现居中

自己再测试下,祝学习愉快!
相似问题