考试需求
请完善
css/style.css
样式文件,让知乎日报首页呈现如下所示的效果(页面整体宽度1024px
):
"
关键尺寸批注如下:(可以通过在图片上右键-》“在新标签页打开图片”,或在右键-》复制图片地址后到浏览器新标签页打开并放大图片,查看关键尺寸
解决办法
先把index.html的左上角logo文字换成图片logo.png
通过调节css来实现对页面的布局
参考代码
index.html更换logo部分
css/style.css
#body {
width: 1024px;
}
#body > header {
height: 78px
}
#body > header > nav > div {
float: right;
}
#body > header > nav > div > a {
display: inline-block;
width: 120px;
height: 32px;
text-align: center;
line-height: 32px;
text-decoration: none;
color: #777;
}
#body > header > nav > div > a:hover {
background-color: #f0f9ff;
color: #0099f2;
}
#body > section.banner > div {
background-color: #008bed;
}
#body > section.banner > div > div:nth-child(1) {
display: inline-block;
}
#body > section.banner > div > div.content {
padding-top: 100px;
padding-left: 100px;
width: 420px;
display: inline-block;
vertical-align: top;
}
#body > section.banner > div > div.content > h2 {
font-size: 40px;
line-height: 40px;
color: #fdfdfd;
}
#body > section.banner > div > div.content > div {
font-size: 16px;
line-height: 24px;
color: #99d1f8;
}
#tabtitle {
width: 960px;
height: 100px;
}
#tabtitle > h3 {
color: #000000;
font-size: 24px;
float: left;
}
#tabtitle > h4 {
color: #cccccc;
font-size: 24px;
float: right;
}
#body > section.list > ul > li > a > img {
padding-left: 24px;
width: 260px;
height: 260px;
}
#body > section.list > ul > li {
text-align: center;
display: inline-block;
width: 300px;
height: 374px;
vertical-align: -webkit-baseline-middle;
margin-bottom: 20px;
margin-right: 30px;
background-color: #ffffff;
}
#body > section.list {
background-color: #f9f9f9;
}
#body > section.list > ul {
padding-left: 20px;
}
#body > section.list > ul > li > a {
text-decoration: none;
color: #333333;
}
#body > section.list > div {
padding-left: 20px;
text-align: center;
background-color: #e8eef2;
}
#body > section.list > div > a {
color: #59abdf;
line-height: 62px;
text-decoration: none;
font-size: 20px;
}
#body > footer {
margin-top: 20px;
background-color: #e5e5e5;
height: 265px;
}
#body > footer > div > div.footerL {
float: left;
width: 710px;
margin-top: 32px;
height: 210px;
}
#body > footer > div > div.footerR {
float: right;
padding: 30px;
text-align: center;
}
最终效果图:
)