学习笔记(响应式布局)

下面展示一些 内联代码片

// A code block
var foo = 'bar';
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<div id="layout">
			<div id="top"></div>
			<div id="main">
				<div>
					<li>分类1</li>
					<li>分类2</li>
					<li>分类3</li>
					<li>分类4</li>
					<li>分类5</li>
					<li>分类6</li>
					<li>分类7</li>
					<li>分类8</li>
				</div>
				<div>
					<li>图片1</li>
					<li>图片2</li>
					<li>图片3</li>
					<li>图片4</li>
					<li>图片5</li>
					<li>图片6</li>
					<li>图片7</li>
					<li>图片8</li>
				</div>
			</div>
		</div>
	</body>
</html>
<style >
	@media (min-width:1000px){
		*{
			padding: 0;
			margin: 0;
			background-color: #FFFFFF;
		}
		#layout{
			display: flex;
			width: 80%;
			flex-direction: column;
			margin: 0 auto;
		}
		#top{
			background-color: #005CBF;
			width: 100%;
			flex: 0 0 50px;
			margin: 0 auto;
		}
		#main{
			flex: 0 0 100%;
			flex-direction: row;
			display: flex;
		}
		#main div:first-child{
			flex: 0 0 10%;
			background-color: #f5f5f5;
			list-style-type: none;
			display: flex;
			flex-wrap: wrap;
			border-left: 1px solid white ;
			border-right: 1px solid white ;
			margin-top: 10px;
		}
		#main div:first-child li{
			flex: 0 0 100%;
			flex-wrap: wrap;
			line-height: 40px;
			height: 40px;
			text-align: center;
			background-color: #999999;
			border-bottom: 1px solid white;
		}
		#main div:nth-child(2){
			flex: 0 0 90%;
			background-color: #f5f5f5;
			list-style-type: none;
			display: flex;
			flex-wrap: wrap;
			justify-content: space-around;
		}
		#main div:nth-child(2) li{
			flex: 0 0 30%;
			height: 120px;
			text-align: center;
			background-color: #008000;
			border-bottom: 1px solid white;
			margin-top: 10px;
		}
	}
	@media (min-width: 350px) and (max-width: 1000px) {
		*{
			padding: 0;
			margin: 0;
			background-color: #FFFFFF;
		}
		#layout{
			display: flex;
			width: 100%;
			flex-direction: column;
			margin: 0 auto;
		}
		#top{
			background-color: #005CBF;
			width: 100%;
			flex: 0 0 50px;
			margin: 0 auto;
		}
		#main{
			flex: 0 0 100%;
			flex-direction: row;
			display: flex;
			flex-wrap: wrap;
		}
		#main div:first-child{
			flex: 0 0 100%;
			background-color: #f5f5f5;
			list-style-type: none;
			display: flex;
			flex-wrap: wrap;
			border-left: 1px solid white ;
			border-right: 1px solid white ;
			margin-top: 10px;
			align-content: flex-start;
		}
		#main div:first-child li{
			flex: 0 0 20%;
			flex-wrap: wrap;
			line-height: 40px;
			height: 40px;
			text-align: center;
			background-color: #999999;
			border-bottom: 1px solid white;
		}
		#main div:nth-child(2){
			flex: 0 0 100%;
			background-color: #f5f5f5;
			list-style-type: none;
			display: flex;
			flex-wrap: wrap;
			justify-content: space-around;
		}
		#main div:nth-child(2) li{
			flex: 0 0 30%;
			height: 120px;
			text-align: center;
			background-color: #008000;
			border-bottom: 1px solid white;
			margin-top: 10px;
		}
	}
</style>

在这里插入图片描述
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值