文西馬龍:http://blog.csdn.net/wenximalong/
案列一
home1.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<link rel="stylesheet" type="text/css" href="home1.css" />
<title>作業1</title>
</head>
<body>
<div class="div1">
<ul class="faceul">
<li><img src="m4.jpg" /></li>
</ul>
</div>
</body>
</html>
home1.css
.div1{
width: 500px;
height: 300px;
border: 1px solid red;
}
.faceul{
width: 200px;
height: 200px;
border: 1px solid blue;
margin-left: 10px;
padding-left: 10px;
}
.faceul img{
margin-top: 10px;
margin-left: 10px;
border: 1px solid black;
}
.faceul li{
list-style-type: none;
}
案例二
分析思路:
建議:具體的寫頁面順序
1.先寫html搞定頁面內容
2.寫css文件來控制樣式
瀏覽器兼容問題
可以參考:別具光芒 div+css講解兼容問題
http://www.verycd.com/topics/2845472/
除非是專業前端開發,不需要深入研究,但是要知道
半成品(將在第17講完成)
素材
==========
home2.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<link rel="stylesheet" type="text/css" href="home2.css" />
<title>home2</title>
</head>
<body>
<!--這是最外層的div-->
<div class="div1">
<!--這是第一個單元-->
<div class="div2">
<span class="span1"><font class="font1">優酷牛人</font><a href="#">更多牛人</a></span>
<ul class="faceul">
<li><img src="m4.jpg" /><br/><a href="#">小貓</a></li>
<li><img src="m4.jpg" /><br/><a href="#">小貓</a></li>
<li><img src="m4.jpg" /><br/><a href="#">小貓</a></li>
</ul>
</div>
</div>
</body>
</html>
home2.css
body{
margin: 0 auto;
width: 800px;
height: 800px;
border: 1px solid blue;
font-size: 12px;
}
.div1{
width: 300px;
height: 250px;
border: 1px solid silver;
}
/*定義幾個常用的字體樣式*/
.font1{
font-weight: bold;
font-size:20px;
margin: 2px 0 0 2px;
}
.span1{
background-color: pink;
display: block;
}
.span1 a{
margin-top: 4px;
float: right;
}
/*盒子的外觀樣式*/
.faceul{
width: 300px;
height: 65px;
background-color: green;
list-style-type: none;
/*ul和li間距*/
padding: 0;
}
.faceul li{
float: left;
}
.faceul li img{
width: 60px;
height: 60px;
}
韓順平_php從入門到精通_視頻教程_學習筆記_源代碼圖解_PPT文檔整理_目錄