响应式布局demo,理解响应式布局

<html>
    <head>
        <meta charset="UTF-8">
        <title>响应式布局</title>
        <meta name="viewport"content="width=device-width,initial-scale=1.0,maximum-scale=1,user-scalable=no" />
        <meta name="format-detection" content="telephone=no,email=no"/>
				<!-- <link rel="stylesheet" type="text/css" href="css/mo2.css"/> -->
		</head>
		<style>
*{
	margin: 0px;
	padding: 0px;
	font-family: "微软雅黑";
}
#head,
#foot,
#main
{
	height: 100px;
	width: 1200px;
	/*width: 85%;*/
	background-color: goldenrod;
	text-align: center;
	font-size: 48px;
	line-height: 100px;
	margin: 0 auto;
}
#head div{
	display: none;
	font-size: 20px;
	height: 30px;
	width: 100px;
	background-color: green;
	float: right;
	line-height: 30px;
	margin-top: 35px;
}
#head ul{
	width: 80%;
}
#head ul li{
	width: 20%;
	float: left;
	text-align: center;
	list-style: none;font-size: 20px;
}
#main{
	height: auto;
	margin: 10px auto;
	overflow: hidden;
}
.left,
.center,
.right{
	height: 600px;
	line-height: 600px;
	float: left;
	width: 20%;
	background-color: red
}
.center{
	width: 60%;
	border-left: 10px solid #FFF;
	border-right: 10px solid #FFF;
	box-sizing: border-box;
}
@media only screen and (max-width: 1200px) {
	#head,
	#foot,
	#main{
	width: 100%;
	}
}
@media only screen and (max-width: 980px) {
	.right{
			display: none;
	}
	.left{
			width: 30%;
	}
	.center{
			width: 70%;
			border-right: hidden;
	}
}
@media only screen and (max-width: 640px) {
	.left,
	.center,
	.right{
			width: 100%;
			display: block;
			height: 200px;
			line-height: 200px;
	}
	.center{
			border: hidden;
			border-top: 10px  solid #FFFFFF;
			border-bottom: 10px solid #FFFFFF;
			height: 600px;
			line-height: 600px;
	}
	#head ul{
			display: none;
	}
	#head div{
			display: block;
	}
}
</style>
    <body>
        <div>
            <header id="head">
                <ul>
                    <li>header1</li>
                    <li>header2</li>
                    <li>header2</li>
                    <li>header2</li>
                    <li>header2</li>
                </ul>
                <div>icon</div>
            </header>
            <section id="main">
                <div class="left">
                    left
                </div>
                <div class="center">
                    center
                </div>
                <div class="right">
                    right
                </div>
            </section>
            <footer id="foot">
                footer
            </footer>
        </div>
    </body>
</html>

在这里插入图片描述
在这里插入图片描述
转载于https://blog.csdn.net/weixin_42529699/article/details/81285919

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

人间清醒小仙女

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值