A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

© 林熙奕 中级黑马   /  2017-11-13 22:33  /  1673 人查看  /  2 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文

[HTML] 纯文本查看 复制代码
<!DOCTYPE HTML>
<html>
<head>
	<meta charset="utf-8" />
	<title></title>
	<meta name="author" content="" />
	<meta name="keyword" content="" />
	<meta name="description" content="" />
	<link rel="shortcut icon" href="mmx.ico?nv=1&v=2" type="image/x-icon" />
	<link rel="bookmark" href="mmx.ico"/>
	<style type="text/css">
	/*
		这里设定的高度只是为了本页面的显示效果,
			设宽不设高
			设高不设宽
		可利用JS缓冲效果进行进一步操作。
		css样式可分离到css文件,
		利用link标签配合media进行加载
		详情请参考w3c.school手册....
	*/
	body,h2{
		margin: 0px;
		padding: 0px;
	}
	#main div,header,aside,footer{
		background: #333;
	}
	#left,#right2{
		margin: 5px 0px;
	}
	h2{
		text-align: center;
	}
	section#container{
		margin: 0 auto;
		width: 80%;
	}
	footer,header{
		width: 100%;
		float: left;
		line-height: 60px;
	}
	#left{
		float: left;
		width: 20%;
	}
	#main{
		float: left;
		width: 60%;
	}
	#right2{
		float: left;
		width: 20%;
	}
	
@media screen and (min-width:1000px){
	h2{
		color: #ffc000;
		font-size: 50px;
		text-shadow: 0px 0px 50px #ffd000;
	}
	#right1{
		display: none;
	}
	#main div{
		margin: 0px 5px;
	}
	#left,#main,#right2{
		line-height: 500px;
		margin: 5px 0px;
	}
}

@media screen and (min-width:640px) and (max-width:999px){
	h2{
		color: #f0f;
		font-size: 30px;
	}
	#main div,header,aside,footer{
		background: #ffc000;
	}
	#left{
		float: left;
		width: 49%;
		line-height: 250px;
	}
	#right1{
		float: right;
		width: 49%;
		line-height: 250px;
		margin: 5px 0px;
	}
	#main{
		float: right;
		width: 100%;
		line-height: 300px;
		margin-bottom: 5px;
	}
	#right2{
		display: none
	}
}

@media screen and (max-width:639px){
	h2{
		color: #333;
		font-size: 20px;
		text-shadow: 0px 0px 10px #353;
	}
	#main div,header,aside,footer{
		background: #f0f;
	}
	#left{
		width: 100%;
		line-height: 150px;
	}
	#right1{
		display: none;
	}
	#main{
		width: 100%;
		line-height: 250px;
	}
	#right2{
		width: 100%;
		line-height: 150px;
	}
}
	</style>
</head>
<body>
	<section id="container">
		<header>
			<h2>
				Header
			</h2>
		</header>
		
		<aside id="left">
			<h2>
				Left
			</h2>
		</aside>
		
		<aside id="right1">
			<h2>
				Right
			</h2>
		</aside>
		
		<section id="main">
			<div>
				<h2>
					Main
				</h2>
			</div>
		</section>

		<aside id="right2">
			<h2>
				Right
			</h2>
		</aside>
		
		<footer>
			<h2>
				Footer
			</h2>
		</footer>
	</section>
</body>
</html>

评分

参与人数 1黑马币 +5 收起 理由
Debughebug + 5 赞一个!原来响应式的写法是这样的666.

查看全部评分

2 个回复

倒序浏览
我来抢沙发占下楼层
回复 使用道具 举报
Debughebug 发表于 2017-11-14 11:35
我来抢沙发占下楼层

没有啦,谢谢一楼打赏的黑马币,(*^__^*) 嘻嘻
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 加入黑马