1.dw創建一個html基本頁面。採用的是外部調用css。
2.素材-背景圖片-和頭部圖片:
html部分:
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <title>個人學習筆記</title>
- <meta http-equiv="Content-Type" content="text/html; charset=gbk" />
- <link rel='stylesheet' type='text/css' media='all' href='style.css' />
- <style type='text/css' media='screen'>@import "style.css";</style>
- </head>
- <body id = "index_body" class = "home">
- <!--編碼開始-->
- <div id = "wrapper">
- <div id = "header">
- <h1>個人學習筆記</h1>
- <ul id = "mainNav">
- <li><a href = "#" id = "home">home</a></li>
- <li><a href = "#">PHP</a></li>
- <li><a href = "#">JavaScript</a></li>
- <li><a href = "#">Html/Css</a></li>
- <li><a href = "#" id="gallery">Mysql</a></li>
- <li><a href = "#">Linux</a></li>
- <li><a href = "#">Smarty</a></li>
- <li><a href = "#" id="contact">About</a></li>
- </ul>
- <!-- 主導航結束-->
- <!--header div-->
- </div>
- <div id = "footer">
- </div>
- <!--wrapper div-->
- </div>
- </body>
- </html>
CSS樣式表部分:CSS樣式表名稱:style.css
- body{
- margin:0;
- padding:0;
- font:70% 'Lucida Grande',Verdana, Helvetica, sans-serif; /*通用字體族*/
- }
- #index_body{
- background:#CAC78A url('images/background.gif') repeat-x fixed;
- }
- /*index body部分背景*/
- a:link{
- background-color: transparent;
- text-decoration: underline;
- color: #666;
- }
- a:hover{
- background-color:#FFC;
- text-decoration:underline;
- color:#990;
- }
- a:visited{
- background-color:transparent;
- text-decoration:underline;
- color:#666;
- }
- /*下面是header部分*/
- h1{
- margin:0;
- padding:30px;
- font-size:150%;
- color:#FF0000;
- text-indent:-9000px; /*屬性規定文本塊中首行文本的縮進。 */
- }
- h2 {
- margin: 0 10px 0 10px;
- padding: 2px;
- font-size: 130%;
- color: #A3A06F;
- background: #E5E2A9;
- }
- h3 {
- text-transform: uppercase;
- display: inline;
- font-size: 92%;
- margin: 10px 5px 0 5px;
- padding: 2px;
- }
- /*wrapper Css。 */
- #wrapper{
- width:750px;
- margin:0 auto;
- background-color:#D7D493;
- padding:0 10px 10px 10px;
- }
- /*header Css。 */
- #header{
- width:750px;
- height:170px;
- background:url('images/header.gif');
- }
- #mainNav
- {
- margin: 30px 0 0 0;
- padding: 0;
- width: 750px;
- height: 35px;
- font-weight: bold;
- font-size: 90%;
- }
- #mainNav ul
- {
- list-style: none;
- margin: 0;
- padding: 0;
- border: none;
- }
- #mainNav li
- {
- display: block;
- margin: 0;
- padding: 0;
- float: left;
- width: auto;
- }
- #mainNav a
- {
- color: #D7D493;
- display: inline;
- width: auto;
- text-decoration: none;
- background: #000;
- margin: 0;
- padding: 10px 10px;
- border-right: 1px solid #FFF;
- }
- #mainNav a:hover, #mainNav a:active { background: #D7D493;color: #000; }
- #mainNav a.active:link, #mainNav a.active:visited
- {
- position: relative;
- z-index: 102;
- background: #BBB;
- color: #D7D493;
- font-weight: bold;
- }
//最後的效果: