<响应式布局>3---设计案例样式文件的另一种引入方式

1.main.html:

<html>
	<head>
		<title>响应式网站布局</title>
		<meta charset="utf-8">
		<>
		<link rel="stylesheet" type="text/css" href="style1.css" />
		<link rel="stylesheet" type="text/css" media="screen and (min-width:1580px)" href="pc.css" />
		<link rel="stylesheet" type="text/css" media="screen and (min-width:1000px) and (max-width:1550px)" href="pad.css" />
		<link rel="stylesheet" type="text/css" media="screen and (max-width:1000px)" href="phone.css" />
	</head>
		
	<body>
		<section id="container">
			<header id="head"><h1>header</h1></header>
			<aside id="left"><h1>left</h1></aside>
			<section id="main"><h1>main</h1></section>
			<aside id="right"><h1>right</h1></aside>
			<footer id="foot"><h1>footer</h1></footer>
		</section>
	</body>
</html></span>

2.style.css:

body {
	padding:0;
	margin:0;
	border:0;
}

h1 {
	font-size:50px;
	color:gold;
	text-align:center;
}

#container {
	width:1280px;
	margin:0 auto;
	background:red;
}

#head {
	width:100%;
	line-height:100px;
	float:left;
	margin:10px 0;
	background:#000;
}

#left {
	width:200px;
	line-height:580px;
	float:left;
	background:#000;
}

#main {
	width:860px;
	line-height:580px;
	float:left;
	margin:0 10px;
	background:#000;
}

#right {
	width:200px;
	line-height:580px;
	float:right;
	background:#000;
}

#foot {
	width:100%;
	line-height:100px;
	float:left;
	margin:10px 0;
	background:#000;
}

</span><pre name="code" class="css"><span style="font-size:14px;">/*以下针对宽度1550px以上的平台,如PC。*/
@media screen and (min-width:1550px) {
<span style="white-space:pre">	</span>
}
</span>
/*pad 1000--1550px*/@media screen and (min-width:1000px) and (max-width:1550px){}/*手机420--1000px*/@media screen and (max-width:1000px) {}

 
3.pc.css: 

/*以下针对宽度1000px以上的平台,如PC。*/
	
h1 {
	color:teal;
}	
</span>

4.pad.css:

h1 {
	font-size:40px;
	color:green;
}

#container {
	width:600px;
}

#left {
	width:100px;
}

#main {
	width:490px;
	margin-left:10px;
	margin-right:0;
}

#right {
	display:none;
}</span>

5.phone.css:

h1 {
	font-size:30px;
	color:red;
}

#container {
	width:400px;
}

#head {
	line-height:80px;
}

#left {
	display:none;
}

#main {
	width:100%;
	line-height:400px;
	margin:10px 0;
}

#right {
	display:none;
}

#foot {
	width:100%;
	line-height:80px;
}</span>



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值