2018百度前端技术学院 第五六课 编码作业
一、课程题目
这节课给出了三份文字内容相同的简历,但是样式布局不一样。题目要求我们使用同一份HTML结构内容,三份不同的CSS代码分别实现图片所示的样式,达到HTML结构内容和CSS样式的解耦。
备注要求:
- 实现时必须保证布局的一致
- 字体、宽高、边距等不需要完全一致
二、HTML编写
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="css/style_3.css">
<title>百度前端技术学院-day5</title>
</head>
<body>
<h1>简历</h1>
<div class="info">
<div class="header">
<h2>基本信息</h2>
<div class="right">
<span>姓名</span>  
<p class="in">张三</p>   
<span>性别</span>  
<p class="in">男</p>   
<span>应聘职位</span>  
<p class="in">Web前端工程师</p>
</div>
</div>
<div class="header">
<h2>联系方式</h2>
<div class="right">
<span>手机</span>  
<p class="in">12312341234</p>   
<span>Email</span>  
<p class="in"><a href="#"> joinefe@baidu.com</a></p>   
<span>个人主页</span>  
<p class="in"><a href="#">GitHub</a></p>
</div>
</div>
<div class="header">
<h2>能力描述</h2>
<div class="right">
<span>技术能力</span>
<p class="in2">熟练掌握HTML,CSS,JavaScript</p>
<br>
<span>综合能力</span>
<p class="in2">良好的沟通,主动积极,努力勤奋</p>
</div>
</div>
<div class="header">
<h2>教育经历</h2>
<div class="right">
<span>本科</span>
<p class="in2">百度前端技术学院小薇学院</p>
<br>
<span>研究生</span>
<p class="in2">百度前端技术学院大斌学院</p>
</div>
</div>
<div class="header">
<h2>项目经历</h2>
<div class="right">
<span>小度小度</span>
<p class="in2">作为前端工程师角色参与了ABC组件的开发</p>
<br>
<span>SAN Doc</span>
<p class="in2">作为文档工程师参与了SAN Doc编写</p>
</div>
</div>
</div>
</body>
</html>
三、简历一的CSS编写
.in{
display: inline;
}
span{
font-weight: bold;
}
四、简历二的CSS编写
body,div,dl,dt,dd,ul,li,h1,input,form,a,p,text{
margin:0;
padding: 0;
}
h1{
background-color: #65A5FA;
color: #ffffff;
width: 180px;
height: 700px;
float: left;
text-align: center;
padding-top: 30px;
}
.info{
width: 900px;
height: 650px;
margin-left: 30px;
float: left;
}
.in{
display: inline;
}
span{
font-weight: bold;
}
五、简历三的CSS编写
body,div,dl,dt,dd,ul,li,h1,input,form,a,p,text{
margin:0;
padding: 0;
}
span{
font-weight: bold;
}
.in{
display: inline;
}
.in2{
display: inline;
}
h1{
width: 1060px;
height: 100px;
background-color: #858585;
color: #ffffff;
line-height: 100px;
padding-left: 20px;
}
.header{
width: 1078px;
height: 150px;
border: #D6D6D6 solid 1px;
}
h2{
width: 148px;
height: 148px;
background-color: #D6D6D6;
float: left;
margin: 0px;
text-align: center;
line-height: 148px;
}
.right{
float: left;
margin-top: 10px;
margin-left: 10px;
}
六、总结
先分析HTML内容,找出格式相同的内容,思考用什么样的元素组装。(在这一点上我做的很不好,一直觉得有更符合语义化的元素表达,但是始终想不到,大神有更好的方法可以评论区中指出)
再分析三个样式的共同点,寻找可以通用的盒子,最后再编码。