flex综合 应用,制作携程旅游,主页面效果。

 

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>携程网Demo</title>
		<style type="text/css">
			* {
				padding: 0;
				margin: 0;
			}
			/* 顶部快的样式 */
			header {
				width: 100%;
				/* 设置伸缩盒子 */
				display: flex;
			}
			header>a {
				flex: 1;
			}
			header>a>img {
				/* 图片宽度,占据100% */
				width: 100%;
			}

			/* 主题内容块样式 */
			main {
				width: 100%;
				padding: 0 10px;
				/* 设置盒模型 */
				box-sizing: border-box;
			}
			/* 设置总高度,100px */
			main>.item {
				width: 100%;
				height: 100px;
				background-color: #7DFFE7;
				border-radius: 10px;
				margin-top: 10px;
				/* 设置为伸缩盒子 */
				display: flex;
			}

			/* 第二个元素,设置单独背景 */
			main>.item:nth-of-type(2) {
				background-color: pink;
			}
			main>.item:nth-of-type(3) {
				background-color: purple;
			}
			main>.item:nth-of-type(4) {
				background-color: #33ff66;
			}

			main>.item>.left {
				flex: 1;
			}
			main>.item>.right {
				flex: 2;
				/* 设置换行显示 */
				flex-wrap: wrap;
				/* 设置为伸缩盒子 */
				display: flex;
			}
			main>.item>.right>a {
				/* 如果想让子元素换行显示,必须为子元素设置宽度 */
				width: 50%;
				display: block;
				text-align: center;
				line-height: 50px;
				color: #fff;
				/* 去掉a标签的下划线 */
				text-decoration: none;
				border-left: 1px solid #fff;
				border-bottom: 1px solid #fff;
				box-sizing: border-box;
			}

			/* 拿到最后2个a元素(-n+2) */
			main>.item>.right>a:nth-last-of-type(-n+2) {
				/* 去掉最后2个的底部边框 */
				border-bottom: none;
			}
			main>.extra {
				width: 100%;
				display: flex;
			}
			main>.extra>a {
				flex: 1;
			}
			/* 图片分别占据50% */
			main>.extra>a>img {
				width: 100%;
			}

			/* 添加底部块的样式 */
			footer {
				width: 100%;
				font-size: 13px;
			}
			footer>nav {
				width: 100%;
				display: flex;
				border-top: 1px solid #CCCCCC;
				border-bottom: 1px solid #CCCCCC;
			}
			footer>nav>a {
				flex: 1;
				line-height: 30px;
				text-align: center;
				text-decoration: none;
				color: #888;
			}
			footer>.link {
				text-align: center;
				line-height: 25px;
			}
			footer>.copyRight {
				text-align: center;
				line-height: 25px;
			}
		</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/sub_banner01.png" alt="">
					</a>
					<a href="">
						<img src="../images/sub_banner02.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">&copy;2015 携程旅行</p>
			</footer>
		</div>
	</body>
</html>

 

 

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值