第32 章項目實戰-移動端流體布局4

來源:互聯網
上載者:User

標籤:

第32 章項目實戰-移動端流體布局[4]
學習要點:
1.旅遊圖片部分

本章主要開始如果通過第一個PC 端項目進行重構,設計成移動端可訪問的頁面,這個
項目採用的是流體布局。
一.旅遊圖片部分
//HTML 部分
<div class="container">
<figure>
<img src="img/tour1.png" >
<figcaption>
<h4>&lt;曼穀-芭提雅6 日遊&gt;</h4>
<p>包團特惠,超豐富景點</p>
<div class="info">
<em class="sat">滿意度77%</em>
<span class="price">¥ <strong>2864</strong> 起</span>
</div>
</figcaption>
</figure>
<figure>
<img src="img/tour2.png" >
<figcaption>
<h4>&lt;馬爾代夫雙魚島Olhuveli4 晚6 日自助遊&gt;</h4>
<p>上海出發,機+酒包含:早晚餐+快艇</p>
<div class="info">
<em class="sat">滿意度97%</em>
<span class="price">¥ <strong>8039</strong> 起</span>
</div>
</figcaption>
</figure>
<figure>
<img src="img/tour3.png" >
<figcaption>
<h4>&lt;海南雙飛5 日遊&gt;</h4>
<p>含鹽城接送,全程掛牌四星酒店</p>
<div class="info">
<em class="sat">滿意度90%</em>
<span class="price">¥ <strong>2709</strong> 起</span>
</div>
</figcaption>
</figure>
<figure>
<img src="img/tour4.png" >
<figcaption>
<h4>&lt;富山-大阪-東京8 日遊&gt;</h4>
<p>暑期親子,2 天自由,無導遊安排</p>
<div class="info">
<em class="sat">滿意度97%</em>
<span class="price">¥ <strong>9499</strong> 起</span>
</div>
</figcaption>
</figure>
<figure>
<img src="img/tour5.png" >
<figcaption>
<h4>&lt;法瑞意德12 日遊&gt;</h4>
<p>4 至5 星,金色列車,少女峰</p>
<div class="info">
<em class="sat">滿意度97%</em>
<span class="price">¥ <strong>9199</strong> 起</span>
</div>
</figcaption>
</figure>
<figure>
<img src="img/tour6.png" >
<figcaption>
<h4>&lt;巴厘島6 日半自助遊&gt;</h4>
<p>藍夢出海,獨棟別墅,悅榕莊下午茶</p>
<div class="info">
<em class="sat">滿意度95%</em>
<span class="price">¥ <strong>6488</strong> 起</span>
</div>
</figcaption>
</figure>
<figure>
<img src="img/tour7.png" >
<figcaption>
<h4>&lt;塞舌爾杜拜9 日自助遊&gt;</h4>
<p>一遊兩國,4 晚塞舌爾,2 晚杜拜</p>
<div class="info">
<em class="sat">滿意度100%</em>
<span class="price">¥ <strong>9669</strong> 起</span>
</div>
</figcaption>
</figure>
<figure>
<img src="img/tour8.png" >
<figcaption>
<h4>&lt;花樣姐姐土耳其9 日或10 日遊&gt;</h4>
<p>最高立減3000!中餐六菜一湯</p>
<div class="info">
<em class="sat">滿意度93%</em>
<span class="price">¥ <strong>9999</strong> 起</span>
</div>
</figcaption>
</figure>
</div>
<div class="clearfix"></div>
//CSS 部分
//去掉邊框計算
div,figure,figcaption {
box-sizing: border-box;
}
//樣式部分
#tour figure {
width: 50%;
float: left;
background-color: #eee;
margin: 0 0 .05rem 0;
font-size: .16rem;
}
#tour figure img {
padding: .02rem;
vertical-align: middle;
border-radius: .04rem;
}
#tour figcaption {
color: #666;
padding: .02rem .05rem;
}
#tour figcaption h4 {
display: block;
font-weight: normal;
padding: .05px 0;
overflow: hidden;
white-space:nowrap;
text-overflow:ellipsis;
}
#tour figcaption p {
overflow: hidden;
white-space:nowrap;
text-overflow:ellipsis;
}
#tour .info {
padding: .1rem 0 0 0;
font-size: .16rem;
}
#tour .price {
color: #f60;
}
#tour .price strong {
letter-spacing: 0.01rem;
}
#tour .sat {
color: #999;
font-style: normal;
float: right;
position: relative;
right: .05rem;
}
//媒體查詢
/*媒體查詢,大於480px 小於640px*/
@media (min-width: 480px) and (max-width: 640px) {
#tour h2 {
font-size: .26rem;
}
#tour h3, #footer, #tour figure, #tour .info {
font-size: .16rem;
}
}
/*媒體查詢,小於480px*/
@media (max-width: 480px) {
#tour h2 {
font-size: .20rem;
}
#tour h3, #tour .info,#tour figure {
font-size: .14rem;
}
#footer {
font-size: .12rem;
}
}

代碼

<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0,minimum-scale=1.0, maximum-scale=1.0,user-scalable=no">
<title>瓢城旅行社-移動端</title>
<link rel="stylesheet" href="css/style.css">
</head>
<body>

<header id="header">
<nav class="link">
<h2 class="none">網站導航</h2>
<ul>
<li class="active"><a href="index.html">首頁</a></li>
<li><a href="information.html">資訊</a></li>
<li><a href="ticket.html">票務</a></li>
<li><a href="about.html">關於</a></li>
</ul>
</nav>
</header>

<div id="adver">
<img src="img/adver.png" >
</div>

<div id="search">
<input type="text" class="search" placeholder="請輸入旅遊景點或城市">
<button class="button">搜尋</button>
</div>

<div id="tour">
<hgroup>
<h2>熱門旅遊</h2>
<h3>最新的各種熱門旅遊資訊的推薦!</h3>
</hgroup>
<div class="container">
<figure>
<img src="img/tour1.png" >
<figcaption>
<h4>&lt;曼穀-芭提雅6 日遊&gt;</h4>
<p>包團特惠,超豐富景點</p>
<div class="info">
<em class="sat">滿意度 77%</em>
<span class="price">¥ <strong>2864</strong> 起</span>
</div>
</figcaption>
</figure>
<figure>
<img src="img/tour2.png" >
<figcaption>
<h4>&lt;馬爾代夫雙魚島Olhuveli4 晚6 日自助遊&gt;</h4>
<p>上海出發,機+酒包含:早晚餐+快艇</p>
<div class="info">
<em class="sat">滿意度 97%</em>
<span class="price">¥ <strong>8039</strong> 起</span>
</div>
</figcaption>
</figure>
<figure>
<img src="img/tour3.png" >
<figcaption>
<h4>&lt;海南雙飛5 日遊&gt;</h4>
<p>含鹽城接送,全程掛牌四星酒店</p>
<div class="info">
<em class="sat">滿意度90%</em>
<span class="price">¥ <strong>2709</strong> 起</span>
</div>
</figcaption>
</figure>
<figure>
<img src="img/tour4.png" >
<figcaption>
<h4>&lt;富山-大阪-東京8 日遊&gt;</h4>
<p>暑期親子,2 天自由,無導遊安排</p>
<div class="info">
<em class="sat">滿意度97%</em>
<span class="price">¥ <strong>9499</strong> 起</span>
</div>
</figcaption>
</figure>
<figure>
<img src="img/tour5.png" >
<figcaption>
<h4>&lt;法瑞意德12 日遊&gt;</h4>
<p>4 至5 星,金色列車,少女峰</p>
<div class="info">
<em class="sat">滿意度97%</em>
<span class="price">¥ <strong>9199</strong> 起</span>
</div>
</figcaption>
</figure>
<figure>
<img src="img/tour6.png" >
<figcaption>
<h4>&lt;巴厘島6 日半自助遊&gt;</h4>
<p>藍夢出海,獨棟別墅,悅榕莊下午茶</p>
<div class="info">
<em class="sat">滿意度95%</em>
<span class="price">¥ <strong>6488</strong> 起</span>
</div>
</figcaption>
</figure>
<figure>
<img src="img/tour7.png" >
<figcaption>
<h4>&lt;塞舌爾杜拜9 日自助遊&gt;</h4>
<p>一遊兩國,4 晚塞舌爾,2 晚杜拜</p>
<div class="info">
<em class="sat">滿意度100%</em>
<span class="price">¥ <strong>9669</strong> 起</span>
</div>
</figcaption>
</figure>
<figure>
<img src="img/tour8.png" >
<figcaption>
<h4>&lt;花樣姐姐土耳其9 日或10 日遊&gt;</h4>
<p>最高立減3000!中餐六菜一湯</p>
<div class="info">
<em class="sat">滿意度93%</em>
<span class="price">¥ <strong>9999</strong> 起</span>
</div>
</figcaption>
</figure>
<div class="clearfix"></div>
</div>
</div>

<footer id="footer">
<div class="top">
用戶端 | 觸屏版 | 電腦版
</div>
<div class="bottom">
Copyright © YCKU 瓢城旅行社 | 蘇ICP備120110119號
</div>
</footer>

</body>
</html>

 

@charset "utf-8";
html {
font-size: 625%;
}
body,h1,h2,h3,h4,p,ul,ol,form,fieldset,figure {
margin: 0;
padding: 0;
}
body {
background-color: #fff;
font-family: "Helvetica Neue", Helvetica, Arial, "Microsoft Yahei UI", "Microsoft YaHei", SimHei, "\5B8B\4F53", simsun, sans-serif;
font-size: .16rem;
}
ul,ol {
list-style: outside none none;
}
a {
text-decoration: none;
}
img {
display: block;
max-width: 100%;
}
div,figure,figcaption {
box-sizing: border-box;
}
.none {
display: none;
}
.clearfix:after {
content: ‘.‘;
display: block;
clear: both;
height: 0;
visibility: hidden;
}
#header {
width: 100%;
height: .45rem;
background-color: #333;
font-size: 0.16rem;
}
#header .link {
height: .45rem;
line-height: .45rem;
color: #eee;
}
#header .link li {
width: 25%;
text-align: center;
float: left;
}
#header .link a {
color: #eee;
display: block;
}
#header .link a:hover,
#header .active a {
background-color: #000;
}
#adver {
max-width: 6.4rem;
margin: 0 auto;
}
#footer {
max-width: 6.4rem;
background-color: #222;
color: #777;
margin: 0 auto;
text-align: center;
padding: .1rem 0;
font-size: .16rem;
}
#footer .top {
padding: 0 0 .05rem 0;
}
#search {
max-width: 6.4rem;
height: .33rem;
margin: 0 auto;
background-color: #ddd;
padding: .03rem 0 0 0;
position: relative;
}
#search .search {
width: 95%;
height: .27rem;
border-radius: .04rem;
border: none;
outline: none;
background-color: #fff;
display: block;
margin: 0 auto;
font-size: .14rem;
padding: 0 .05rem;
}
#search .button {
display: block;
outline: none;
width: .5rem;
height: .27rem;
color: #666;
border: none;
background-color: #eee;
border-top-right-radius: .04rem;
border-bottom-right-radius: .04rem;
font-size: .14rem;
position: absolute;
top: .03rem;
right: 1%;
}
#tour {
max-width: 6.4rem;
margin: .1rem auto 0 auto;
}
#tour h2 {
text-align: center;
color: #666;
font-size: .26rem;
}
#tour h3 {
text-align: center;
color: #666;
font-weight: normal;
font-size: .16rem;
margin: .05rem 0 .1rem 0;
}
#tour figure {
width: 50%;
float: left;
background-color: #eee;
font-size: .16rem;
padding: 0 0 .05rem 0;
}
#tour figure img {
padding: .02rem;
border-radius: .04rem;
}
#tour figcaption {
color: #666;
font-size: .16rem;
padding: .02rem .05rem;
}
#tour h4 {
font-weight: normal;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
#tour p {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
#tour .info {
padding: .1rem 0 0 0;
font-size: .16rem;
}
#tour .price {
color: #f60;
}
#tour .price strong {
letter-spacing: .01rem;
}
#tour .sat {
position: relative;
float: right;
right: .05rem;
font-style: normal;
}


/*媒體查詢,大於480px小於640px*/
@media (min-width: 480px) and (max-width: 640px) {
#tour h2 {
font-size: .26rem;
}
#tour h3, #footer, #tour figcaption, #tour .info {
font-size: .16rem;
}
}

/*媒體查詢,小於480px*/
@media (max-width: 480px) {
#tour h2 {
font-size: .20rem;
}
#tour h3, #tour figcaption, #tour .info {
font-size: .14rem;
}
#footer {
font-size: .12rem;
}
}

第32 章項目實戰-移動端流體布局4

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.