老师您好,请检查作业,谢谢

老师您好,请检查作业,谢谢

4-8 自由编程


about区域布局效果的实现需要使用浮动和定位,前面我们已经学习过了这两个知识点,接下来让我们参考效果标注图,完成这部分的布局吧~


CSS相关代码:

*{
margin: 0;
padding: 0;
}
.about{
width: 1200px;
margin: 0 auto;
margin-top: 30px;
}
.about h2{
font-size: 32px;
text-align: center;
}
.about .about-underline{
width: 60px;
height: 3px;
background-color: #07cbc9;
margin: 10px auto;
}
.about .about-intro{
width: 440px;
height: 60px;
font-size: 14px;
color: grey;
text-align: center;
margin: 0 auto;
}
.about .about-content{
position: relative;
width: 1200px;
height: 464px;

}
.about .about-content h3{
float: left;
font-size: 28px;
margin-top: 20px;
}
.about .about-content .about-article{
position: absolute;
float: left;
top: 50%;
margin-top: -103px;
width: 300px;
padding: 20px;
font-size: 18px;
border: 1px solid grey;
background: rgba(255, 255, 255, 0.5);
}
.about .about-content .about-article .btn-explore{
width: 140px;
height: 40px;
background-color: black;
color: white;
text-align: center;
line-height: 40px;
margin-top: 25px;
}
.about .about-content img{
float: left;
margin-top: 30px;
margin-left: 125px;
}
.about .about-content .student-num{
float: right;
width: 260px;
padding-top: 40px;
padding-bottom: 40px;
margin-top: 30px;
margin-bottom: 30px;
text-align: center;
border: 1px solid #07cbc9;
}
.about .about-content .student-num .r1{
font-size: 20px;
font-weight: bold;
}
.about .about-content .student-num .underline{
width: 45px;
height: 3px;
background-color: #07cbc9;
margin: 10px auto;
}
.about .about-content .faculty-num{
float: right;
width: 260px;
padding-top: 40px;
padding-bottom: 40px;
text-align: center;
border: 1px solid #07cbc9;
}
.about .about-content .faculty-num .r1{
font-size: 20px;
font-weight: bold;
}
.about .about-content .faculty-num .underline{
width: 45px;
height: 3px;
background-color: #07cbc9;
margin: 10px auto;
}


HTML相关代码:

<!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.css">
</head>
<body>
<div class="about">
<h2>ABOUT</h2>
<div class="about-underline"></div>
<div class="about-intro">Dorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s
</div>
<div class="about-content">
<h3>A WORD<br/>
ABOUT US
</h3>
<div class="about-article">
<p>
Praesent dignissim viverra est,sed bibendum ligula congue non.
Sed ac nisl et felis gravida commodo? Suspendisse eget ullamcorper ipsum.
Suspendisse diam amet
</p>
<div class="btn-explore">EXPLORE</div>
</div>
<img src="images/bb3.jpg">
<div class="student-num">
<div class="r1">70000</div>
<div class="underline"></div>
<p>Students</p>
</div>
<div class="faculty-num">
<div class="r1">600</div>
<div class="underline"></div>
<p>Faculty</p>
</div>
</div>
</div>
</body>
</html>

相关图片:

https://img1.sycdn.imooc.com//climg/60bc785c08b6fe7a06500435.jpg

正在回答

登陆购买课程后可参与讨论,去登陆

1回答

同学你好,代码可以实现需求。如下建议仅供参考:从设计图上来看我们可以将结构分为如下

https://img1.sycdn.imooc.com//climg/64c20d370963d0f914800618.jpg

祝学习愉快!

  • lura827 提问者 #1

    老师,感谢答复!

    请问一下,您的建议的意思是,每个框架设置一个div吗?

    2023-07-28 09:53:51
  • 好帮手慕小李 回复 提问者 lura827 #2
    对,这样结构更加稳定。
    2023-07-28 09:58:41
  • lura827 提问者 回复 好帮手慕小李 #3

    好的 明白了老师

    2023-07-30 07:36:30
问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
请稍等 ...
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师