<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>猪猪旅行</title>
<style>
* {
margin: 0;
padding: 0;
}
header{
width: 100%;
display: flex;
}
header > a {
flex: 1;
}
header > a > img {
width: 100%;
}
main {
margin: 10px auto;
width: 100%;
padding: 0 10px;
box-sizing: border-box;
}
.item {
width: 100%;
height: 100px;
margin-top: 10px;
display: flex;
background-color: dodgerblue;
border-radius: 10px;
}
.item:nth-of-type(2) {
background-color: deepskyblue;
}
.item:nth-of-type(3) {
background-color: cornflowerblue;
}
.item:nth-of-type(4) {
background-color: skyblue;
}
main > .item >.left {
flex: 1;
}
main > .item > .right {
flex: 2;
/*设置换行显示,子元素的宽度之和必须大于父元素的宽*/
flex-wrap: wrap;
/*float的效果,flex可以做到*/
display: flex;
}
.right > a {
width: 50%;
/*因为a是行内元素,所以要使它变成块元素*/
display: block;
text-align: center;
line-height: 50px;
text-decoration: none;
color: #ffffff;
border-bottom: 1px solid white;
border-left: 1px solid white;
box-sizing: border-box;
}
.right > a:nth-last-of-type(-n+2){
border-bottom: none;
}
main > .extra {
width: 100%;
display: flex;
}
main > .extra > a {
flex: 1;
}
main > .extra > a > img {
width: 100%;
}
footer {
width: 100%;
font-size: 13px;
}
footer > nav {
width: 100%;
display: flex;
}
footer > nav > a {
flex: 1;
border-bottom: 1px solid #cccccc;
border-top: 1px solid #cccccc;
box-sizing: border-box;
text-decoration: none;
text-align: center;
line-height: 30px;
color: #999999;
}
footer > .link {
text-align: center;
line-height: 25px;
}
footer > .copyright {
text-align: center;
}
</style>
</head>
<body>
<div class="container">
<header>
<a href="#">
<img src="./images/banner.jpg" alt=""/>
</a>
</header>
<main>
<section class="item">
<div class="left"></div>
<div class="right">
<a href="#">猪猪航班</a>
<a href="#">猪猪酒店</a>
<a href="#">猪猪团购</a>
<a href="#">猪猪美食</a>
</div>
</section>
<section class="item">
<div class="left"></div>
<div class="right">
<a href="#">猪猪航班</a>
<a href="#">猪猪酒店</a>
<a href="#">猪猪团购</a>
<a href="#">猪猪美食</a>
</div>
</section>
<section class="item">
<div class="left"></div>
<div class="right">
<a href="#">猪猪航班</a>
<a href="#">猪猪酒店</a>
<a href="#">猪猪团购</a>
<a href="#">猪猪美食</a>
</div>
</section>
<section class="item">
<div class="left"></div>
<div class="right">
<a href="#">猪猪航班</a>
<a href="#">猪猪酒店</a>
<a href="#">猪猪团购</a>
<a href="#">猪猪美食</a>
</div>
</section>
<section class="extra">
<a href="#">
<img src="./images/extra_1.png" alt=""/>
</a>
<a href="#">
<img src="./images/extra_2.png" alt=""/>
</a>
</section>
</main>
<footer>
<nav>
<a href="#">电话预定</a>
<a href="#">下载客户端</a>
<a href="#">我的</a>
</nav>
<p class="link">
<a href="#">网站地图</a>
<a href="#">English</a>
<a href="#">电脑版</a>
</p>
<p class="copyright">©猪猪旅行</p>
</footer>
</div>
</body>
</html>
flex之伸缩网页
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...