当前位置: 代码迷 >> Web前端 >> 一行来学习《响应式Web设计-HTML5和CSS3实战》吧
  详细解决方案

一行来学习《响应式Web设计-HTML5和CSS3实战》吧

热度:123   发布时间:2012-12-28 10:29:05.0
一起来学习《响应式Web设计-HTML5和CSS3实战》吧

《响应式Web设计-HTML5和CSS3实战》是一本不错的前台设计书。书里主要以一个页面入手,涵盖了HTML5和CSS3的所有知识。

下午我根据http://www.andthewinnerisnt.com 这个网页上的资源下载下来了所需的一些图片,然后构建了主页index.html。这里放上代码,这是本人写的HTML4+CSS2.1的东西。这里分享给大家。大家可以根据上面给的网站自己去下载图片资源,然后使用我写的这个。这样就可以很快进入第三章的学习了。先不说代码,先上图!




首先是页面index.html

<!DOCTYPE html>
<head>
	<meta charset="UTF-8">
	<title>And the winner isn't</title>
	<link href="reset.css" rel="stylesheet" type="text/css">
	<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
	<div id="wrapper">
		<!-- the header and navigation -->
		<div id="header">
			<div id="headline">
				<span>AND THE WINNER IS</span><span id="special_hint">N'T...</span>
			</div>
			<div id="navigation">
				<ul>
					<li><a href="#">WHY?</a></li>
					<li><a href="#">SYNOPSIS</a></li>
					<li><a href="#">STILLS/PHOTOS</a></li>
					<li><a href="#">VIDEOS/CLIPS</a></li>
					<li><a href="#">QUOTES</a></li>
					<li><a href="#">QUIZ</a></li>
				</ul>
			</div>
		</div>
		
		<div id="main">
			<!-- the siderbar -->
			<div id="siderbar">
				<span>UNSUNG HEROES...</span><br>
				<img src="image/cableGuy.jpg"/>
				<img src="image/chicago.jpg"/>
				<br>
				<span>OVERHYPED<br>NONSENSE...</span><br>
				<img src="image/goonies.jpg"/>
				<img src="image/kingKong.jpg"/>
				<br>
			</div>
			<!-- the content -->
			<div id="content">
				<img src="image/oscar.png"></img>
				<div id="text">
				<h1>EVERY YEAR</h1>
				<h2>WHEN I WATCH THE OSCARS I'M ANNOYED...</h2>
				<span>that films like King Kong.Moulin Rouge and Munich get the statue whilst the real cinernatic heroes lose out.Not very Hollywood is it?<br>
					We're here to put things right.
				</span>
				<br>
				<a href="#">these should have won >></a>
				</div>
			</div>
		</div>
		
		<!-- the footer -->
		<div id="footer">
			<div id="notation">NOTE:OUR OPINION IS ABSOLTELY CORRECT.YOU ARE WRONG,EVEN IF YOU THINK YOU ARE RIGHT.THAT'S A FACT.DEAL WITH IT.</div>
			<div id="footimg"></div>
		</div>
	</div>
</body>
</html>

这里用了2个css,其中那个reset是这本书推荐的一个css重置样式

另一个css是我写的,这里给出style.css

#wrapper{
	margin-right:auto;
	margin-left:auto;
	width:960px;
}

#header{
	margin-right:10px;
	margin-left:10px;
	width:940px;
	height:200px;
	background-color:white;
	background-image:url(image/buntingFW.png);
	background-repeat:repeat-x;
}

#headline{
	height:140px;
	font-size:48px;
	font-family:Arial;
}
#headline span{
	position:relative;
	top:70px;
	left:10px;
}
#special_hint{
	color:#aeaeae;
}
#navigation{
	background-color:white;
	background-image:url(image/atwiNavBg.png);
	background-repeat:repeat-x;
	height:30px;
}
#navigation ul{
	margin:0px;
	padding:0px;
}
#navigation ul li{
	display:inline-block;
}
#navigation ul li a{
	text-decoration:none;
	font-size:25px;
	font-family:Arial;
	font-weight:bold;
	color:black;
	margin-left:10px;
	margin-right:10px;
}

#main{
	border-top: dashed 1px #B67F7F;
	border-bottom: dashed 1px #B67F7F;
	background-color:white;
	background-image:url(image/sidebarBg.png);
	background-repeat:repeat-x;
	padding-top:40px;
	height:550px;
}

#siderbar{
	margin-right:10px;
	margin-left:10px;
	padding-left:5px;
	padding-right:5px;
	border-right:solid 3px #eaeaea;
	width:180px;
	float:left;
}

#siderbar span{
	font-size:20px;
	font-family:Arial;
	font-weight:bold;
	color:black;
	clear:both;
}

#siderbar img{
	width:43%;
	float:left;
	padding:10px 5px 10px 5px;
}

#content{
	margin-right:10px;
	float:right;
	margin-left:10px;
	width:700px;
	font-family:Arial;
}
#content img{
	float:left;
	width:200px;
}
#text{
	float:right;
	width:480px;
}
#text h1{
	font-size:70px;
	margin:0px;
	padding:0px;
}
#text h2{
	margin:0px;
	padding:0px;
	font-size:40px;
	color:#7F7F7F;
}
#text span{
	color:#7F7F7F;
	font-size:18px;
	line-height:30px;
	height:30px;
}
#footer{
	display:block;
	margin-right:10px;
	margin-left:10px;
	clear:both;
	width:940px;
	height:150px;
}
#notation{
	height:80px;
	text-align:center;
	padding-top:20px;
	font-size:15px;
	color:brown;
}
#footimg{
	background-image:url(image/buntingFWinvert.png);
	background-repeat:repeat-x;
	height:40px;
}

最后希望大家学习愉快。