放大:
伸缩布局的相关知识点:
flex:none | <' flex-grow '> <' flex-shrink >'? || <' flex-basis '>
none:
在「flex」属性中该值如果被省略则默认为「1」
在收缩的时候收缩比率会以伸缩基准值加权
在「flex」属性中该值如果被省略则默认为「1」
在「flex」属性中该值如果被省略则默认为「0%」
在「flex」属性中该值如果被指定为「auto」,则伸缩基准值的计算值是自身的 <' width '> 设置,如果自身的宽度没有定义,则长度取决于内容。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style type="text/css">
* {
margin: 0;
padding: 0;
list-style: none;
}
a {
text-decoration: none;
color: #333;
}
img {
display: block;
width: 100%;
}
/*导航模块*/
.item {
height: 90px;
display: flex;
background-color: deeppink;
margin:10px;
border-radius: 15px;
}
.item .pub {
flex:1;
width: 200px;
border-right: 1px solid #fff;
border-bottom: 1px solid #fff;
border-top: 1px solid #fff;
}
.item .sub {
flex:2;
}
.item .sub a {
height: 45px;
line-height: 45px;
width: 50%;
float: left;
border: 1px solid #fff;
/*设置盒子的内减模式*/
box-sizing: border-box;
}
.item:nth-child(2) {
background-color: lightyellow;
}
.item:nth-child(3) {
background-color: lightblue;
}
.item:nth-child(4) {
background-color: lightgreen;
}
.extre {
display: flex;
}
.extre a {
margin: 5px;
height: 100px;
overflow: hidden;
flex:1;
}
.f-nav {
margin: 5px;
height: 40px;
line-height: 40px;
border-top: 1px solid #ccc;
border-bottom: 1px solid #ccc;
display: flex;
text-align: center;
}
.f-nav li {
flex:1;
}
.footer p {
text-align: center;
font-size: 16px;
color: #999;
line-height: 30px;
}
.item:nth-child(4) .pub a{
display: block;
width: 100%;
height: 45px;
line-height: 45px;
box-sizing: border-box;
border-bottom: 2px solid #fff;
}
</style>
</head>
<body>
<div class="layout">
<div class="banner">
<a href="#"><img src="banner.png"></a>
</div>
<div class="nav">
<div class="item">
<div class="pub"></div>
<div class="sub">
<a href="javascript:;">海外酒店</a>
<a href="">团购</a>
<a href="">特惠酒店</a>
<a href="">客栈公寓</a>
</div>
</div>
<div class="item">
<div class="pub"></div>
<div class="sub">
<a href="javascript:;">海外酒店</a>
<a href="">团购</a>
<a href="">特惠酒店</a>
<a href="">客栈公寓</a>
</div>
</div>
<div class="item">
<div class="pub"></div>
<div class="sub">
<a href="javascript:;">海外酒店</a>
<a href="">团购</a>
<a href="">特惠酒店</a>
<a href="">客栈公寓</a>
</div>
</div>
<div class="item">
<div class="pub">
<a href="#">门票</a>
<a href="#">10000</a>
</div>
<div class="sub">
<a href="javascript:;">海外酒店</a>
<a href="">团购</a>
<a href="">特惠酒店</a>
<a href="">客栈公寓</a>
</div>
</div>
<div class="extre">
<a href="#"><img src="a_03.jpg"></a>
<a href="#"><img src="a_06.jpg"></a>
</div>
<div class="footer">
<ul class="f-nav">
<li>客户端</li>
<li>关于</li>
<li>联系我们</li>
</ul>
<p>欢迎 | 欢迎 | 欢迎</p>
<p>@2015 携程旅行
</div>
</div>
</div>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style type="text/css">
* {
margin: 0;
padding: 0;
list-style: none;
}
a {
text-decoration: none;
color: #333;
}
img {
display: block;
width: 100%;
}
/*导航模块*/
.item {
height: 90px;
display: flex;
background-color: deeppink;
margin:10px;
border-radius: 15px;
}
.item .pub {
flex:1;
width: 200px;
border-right: 1px solid #fff;
border-bottom: 1px solid #fff;
border-top: 1px solid #fff;
}
.item .sub {
flex:2;
}
.item .sub a {
height: 45px;
line-height: 45px;
width: 50%;
float: left;
border: 1px solid #fff;
/*设置盒子的内减模式*/
box-sizing: border-box;
}
.item:nth-child(2) {
background-color: lightyellow;
}
.item:nth-child(3) {
background-color: lightblue;
}
.item:nth-child(4) {
background-color: lightgreen;
}
.extre {
display: flex;
}
.extre a {
margin: 5px;
height: 100px;
overflow: hidden;
flex:1;
}
.f-nav {
margin: 5px;
height: 40px;
line-height: 40px;
border-top: 1px solid #ccc;
border-bottom: 1px solid #ccc;
display: flex;
text-align: center;
}
.f-nav li {
flex:1;
}
.footer p {
text-align: center;
font-size: 16px;
color: #999;
line-height: 30px;
}
.item:nth-child(4) .pub a{
display: block;
width: 100%;
height: 45px;
line-height: 45px;
box-sizing: border-box;
border-bottom: 2px solid #fff;
}
</style>
</head>
<body>
<div class="layout">
<div class="banner">
<a href="#"><img src="banner.png"></a>
</div>
<div class="nav">
<div class="item">
<div class="pub"></div>
<div class="sub">
<a href="javascript:;">海外酒店</a>
<a href="">团购</a>
<a href="">特惠酒店</a>
<a href="">客栈公寓</a>
</div>
</div>
<div class="item">
<div class="pub"></div>
<div class="sub">
<a href="javascript:;">海外酒店</a>
<a href="">团购</a>
<a href="">特惠酒店</a>
<a href="">客栈公寓</a>
</div>
</div>
<div class="item">
<div class="pub"></div>
<div class="sub">
<a href="javascript:;">海外酒店</a>
<a href="">团购</a>
<a href="">特惠酒店</a>
<a href="">客栈公寓</a>
</div>
</div>
<div class="item">
<div class="pub">
<a href="#">门票</a>
<a href="#">10000</a>
</div>
<div class="sub">
<a href="javascript:;">海外酒店</a>
<a href="">团购</a>
<a href="">特惠酒店</a>
<a href="">客栈公寓</a>
</div>
</div>
<div class="extre">
<a href="#"><img src="a_03.jpg"></a>
<a href="#"><img src="a_06.jpg"></a>
</div>
<div class="footer">
<ul class="f-nav">
<li>客户端</li>
<li>关于</li>
<li>联系我们</li>
</ul>
<p>欢迎 | 欢迎 | 欢迎</p>
<p>@2015 携程旅行
</div>
</div>
</div>
</body>
</html>