利用flex布局完成携程网首页页面

一、效果图

二、HTML部分

		<!--头部-->
		<div class="top">
			<div class="serach">搜索:目的地/酒店/景点/航班号</div>
			<a href="#" class="my">我的</a>
		</div>
		<!--轮播图-->
		<div class="slideshow">
			<img src="img/focus.jpg" />
		</div>
		<!-- 导航栏 -->
		<div class="navigation">
			<a href="">
				<span class="navigation1">
				</span>
				<span>景点·玩乐</span>
			</a>
			<a href="">
				<span class="navigation2"></span>
				<span>景点·玩乐</span>
			</a>
			<a href="">
				<span class="navigation3"></span>
				<span>景点·玩乐</span>
			</a>
			<a href="">
				<span class="navigation4"></span>
				<span>景点·玩乐</span>
			</a>
			<a href="">
				<span class="navigation5"></span>
				<span>景点·玩乐</span>
			</a>
		</div>
		<!-- 内容 -->
		<div class="content">
			<div class="content1">
				<div>
					<div>海外酒店</div>
					<div>
						<img src="img/hotel.png" alt="">
					</div>
				</div>
				<div>
					<div>海外酒店</div>
					<div>特价酒店</div>
				</div>
				<div>
					<div>海外酒店</div>
					<div>特价酒店</div>
				</div>
			</div>
			<div class="content2">
				<div>
					<div>海外酒店</div>
					<div>
						<img src="img/hotel.png" alt="">
					</div>
				</div>
				<div>
					<div>海外酒店</div>
					<div>特价酒店</div>
				</div>
				<div>
					<div>海外酒店</div>
					<div>特价酒店</div>
				</div>
			</div>
			<div class="content3">
				<div>
					<div>海外酒店</div>
					<div>
						<img src="img/hotel.png" alt="">
					</div>
				</div>
				<div>
					<div>海外酒店</div>
					<div>特价酒店</div>
				</div>
				<div>
					<div>海外酒店</div>
					<div>特价酒店</div>
				</div>
			</div>
		</div>
		<!-- 其他图标 -->
		<div class="else">
			<div>
				<a href=""><span></span><span>电话费</span></a>
				<a href=""><span></span><span>保险</span></a>
				<a href=""><span></span><span>外币兑换</span></a>
				<a href=""><span></span><span>购物</span></a>
				<a href=""><span></span><span>当地向导</span></a>
			</div>
			<div>
				<a href=""><span></span><span>自由行</span></a>
				<a href=""><span></span><span>境外玩乐</span></a>
				<a href=""><span></span><span>礼品卡</span></a>
				<a href=""><span></span><span>信用卡</span></a>
				<a href=""><span></span><span>更多</span></a>
			</div>
		</div>
		<!-- 广告 -->
		<div class="advertise">
			<div><img src="img/pic5.jpg" alt=""></div>
			<div><img src="img/pic6.jpg" alt=""></div>
		</div>
		<!-- 标志 -->
		<div class="sign">©2023携去哪儿旅行备01001号</div>
		<!-- 底部 -->
		<div class="bottom">
			<a href="">
				<span></span>
				<span>首页</span>
			</a>
			<a href="">
				<span></span>
				<span>社区</span>
			</a>
			<a href="">
				<span></span>
				<span>消息</span>
			</a>
			<a href="">
				<span></span>
				<span>我的</span>
			</a>
		</div>

三、CSS部分

			* {
				margin: 0;
				padding: 0;
				list-style: none;
			}

			body {
				max-width: 800px;
				min-width: 300px;
				font-family: "微软雅黑";
				margin: 0 auto;
				background-color: lightgray;
			}

			.top {
				width: 100%;
				height: 50px;
				background-color: lightblue;
				position: fixed;
				top: 0;
				left: 0;
				display: flex;
			}

			.serach {
				flex: 1;
				color: gray;
				border: 1px solid gray;
				height: 30px;
				margin: 10px;
				border-radius: 15px;
				font-size: 10px;
				line-height: 30px;
				position: relative;
				padding-left: 25px;
			}

			.serach::before {
				content: "";
				width: 30px;
				height: 30px;
				background: url(img/sprite.png) no-repeat -58px -280px;
				position: absolute;
				background-size: 104px auto;
				top: 10px;
				left: 10px;
			}

			.my {
				width: 50px;
				height: 50px;
				line-height: 70px;
				text-align: center;
				font-size: 15px;
				color: white;
				position: relative;
				text-decoration: none;
			}

			.my::before {
				content: "";
				width: 25px;
				height: 22px;
				background: url(img/sprite.png) no-repeat -58px -193px;
				position: absolute;
				background-size: 104px auto;
				top: 2px;
				left: 12px;
			}

			.slideshow {
				width: 800px;
				margin: auto;

			}

			.slideshow img {
				margin-top: 50px;
				width: 100%;
			}

			.navigation {
				width: 800px;
				height: 80px;
				background-color: white;
				border-radius: 10px;
				display: flex;
			}

			.navigation a {
				width: 20%;
				text-decoration: none;
				font-size: 10px;
				color: black;
				display: flex;
				flex-direction: column;
				justify-content: center;
			}

			.navigation a span:nth-child(2) {
				margin: 0 auto;
			}
			.navigation a span:nth-child(1) {
				margin: 0 auto;
				display: inline-block;
				width: 32px;
				height: 32px;
				background-size: 32px auto;
			}
			.navigation1 {
				background: url(img/localnav_bg.png) no-repeat 0px 0px;
			}

			.navigation2 {
				background: url(img/localnav_bg.png) no-repeat 0px -32px;
			}

			.navigation3 {
				background: url(img/localnav_bg.png) no-repeat 0px -64px;
			}

			.navigation4 {
				background: url(img/localnav_bg.png) no-repeat 0px -96px;
			}

			.navigation5 {
				background: url(img/localnav_bg.png) no-repeat 0px -128px;
			}
			.content {
				background-color: white;
				color: white;
				border-radius: 10px;
			}
			.content1,
			.content2,
			.content3 {
				width: 800px;
				height: 90px;
				background-color: white;
				margin-top: 5px;
				overflow: hidden;
				display: flex;
			}
			.content1 {
				border-radius: 10px 10px 0px 0px;
			}
			.content3 {
				border-radius: 0px 0px 10px 10px;
			}
			.content>div>div {
				width: 33.3%;
				height: 90px;
			}
			.content>div div div {
				height: 50%;
				text-align: center;
				line-height: 45px;
			}

			.content>div>div:nth-child(2) div:nth-child(1),
			.content>div>div:nth-child(3) div:nth-child(1) {
				border-bottom: 1px solid;
			}

			.content>div>div:nth-child(1),
			.content>div>div:nth-child(2) {
				border-right: 1px solid;
			}

			.content img {
				height: 100%;
			}

			.content1 div div {
				background-color: #FA5A55;
			}

			.content2 div div {
				background-color: #FFC0CB;
			}

			.content3 div div {
				background-color: #34C2A9;
			}

			.else {
				margin-top: 5px;
				width: 800px;
				height: 120px;
				background-color: white;
				border-radius: 10px;
			}
			.else div {
				height: 60px;
				display: flex;

			}
			.else div a {
				text-decoration: none;
				color: black;
				width: 20%;
				display: flex;
				flex-direction: column;
				justify-content: center;
				font-size: 10px;
			}
			.else div a span{
				margin:0 auto;
			}
			.else div a span:nth-child(1){
				display: inline-block;
				width: 24px;
				height: 24px;
			}
			.else div:nth-child(1) a:nth-child(1) span:nth-child(1){
				background: url(img/subnav-bg.png) no-repeat 0px 0px;
				background-size: 24px auto;
			}
			.else div:nth-child(1) a:nth-child(2) span:nth-child(1){
				background: url(img/subnav-bg.png) no-repeat 0px -24px;
				background-size: 24px auto;
			}
			.else div:nth-child(1) a:nth-child(3) span:nth-child(1){
				background: url(img/subnav-bg.png) no-repeat 0px -52px;
				background-size: 24px auto;
			}
			.else div:nth-child(1) a:nth-child(4) span:nth-child(1){
				background: url(img/subnav-bg.png) no-repeat 0px -84px;
				background-size: 24px auto;
			}
			.else div:nth-child(1) a:nth-child(5) span:nth-child(1){
				background: url(img/subnav-bg.png) no-repeat 0px -112px;
				background-size: 24px auto;
			}
			.else div:nth-child(2) a:nth-child(1) span:nth-child(1){
				background: url(img/subnav-bg.png) no-repeat 5px -136px;
				background-size: 24px auto;
			}
			.else div:nth-child(2) a:nth-child(2) span:nth-child(1){
				background: url(img/subnav-bg.png) no-repeat 0px -170px;
				background-size: 24px auto;
			}
			.else div:nth-child(2) a:nth-child(3) span:nth-child(1){
				background: url(img/subnav-bg.png) no-repeat 0px -197px;
				background-size: 24px auto;
			}
			.else div:nth-child(2) a:nth-child(4) span:nth-child(1){
				background: url(img/subnav-bg.png) no-repeat 0px -222px;
				background-size: 24px auto;
			}
			.else div:nth-child(2) a:nth-child(5) span:nth-child(1){
				background: url(img/subnav-bg.png) no-repeat 3px -246px;
				background-size: 24px auto;
			}
			.advertise{
				width: 800px;
				display: flex;
				margin-top: 5px;
				overflow: hidden;
			}
			.advertise div{
				flex: 1;
			}
			.advertise div:nth-child(1){
				border-right: 1px solid lightgray;
			}
			.advertise div img{
				width: 100%;
			}
			.sign{
				width: 800px;
				height: 80px;
				line-height: 80px;
				text-align: center;
				color: #555555;
				font-size: 10px;
				margin-bottom: 80px;
			}
			.bottom{
				width: 800px;
				height: 50px;
				background-color: lightblue;
				position: fixed;
				bottom: 0;
				left: auto;
				display: flex;
			}
			.bottom a{
				width: 25%;
				text-decoration: none;
				font-size: 13px;
				color: black;
				display: flex;
				flex-direction: column;
				justify-content: center;
			}
			.bottom a span{
				margin: 0 auto;
			}
			.bottom a span:nth-child(1){
				display: inline-block;
				width: 32px;
				height: 32px;
			}
			.bottom a:nth-child(1) span:nth-child(1){
				background: url(img/tabbar.png) no-repeat 0px 0px;
				background-size: 32px auto;
			}
			.bottom a:nth-child(2) span:nth-child(1){
				background: url(img/tabbar.png) no-repeat 0px -30px;
				background-size: 32px auto;
			}
			.bottom a:nth-child(3) span:nth-child(1){
				background: url(img/tabbar.png) no-repeat 0px -60px;
				background-size: 32px auto;
			}
			.bottom a:nth-child(4) span:nth-child(1){
				background: url(img/tabbar.png) no-repeat 0px -90px;
				background-size: 32px auto;
			}

提示:

相关图片请自行修改

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值