製作簡易的個人主頁(程式碼筆記)
阿新 • • 發佈:2019-01-02
//html
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="description" content="This is a testing demo page"> <meta name="keywords" content="testing,html,demo"> <meta name="viewport" content="width=device-width,initial-scale=1.0"> <title>Testing Demo Project</title> <link rel="stylesheet" type="text/css" href="project.css"> <link rel="stylesheet" href="lib/bootstrap/css/bootstrap.min.css"> </head> <body> <div id="head"> <div class="logo_title"> <h1>LinuxCast.net Demo Site</h1> <h2>簡易的個性主頁</h2> </div> <div class="navi"> <ul> <li><a href = "">首頁</a></li> <li><a href = "">閒言碎語</a></li> <li><a href = "">我是誰</a></li> </ul> </div> <div class="clear"></div> </div> <div id="wrapper"> <div class="main"> <div class="item"> <div class="item_img"> <img src="cast.png" alt="Testing Demo Project pic"> </div> <div class="item_content"> <h3>LinuxCast測試標題測試標題</h3> <p class="item_info">作者:XXX 發表於:2017年7月15號</p> <p class="item_desc">LinuxCast測試內容測試內容測試內容測試文字測<br> 測試文字測試文字測試文字測試文字測試文字測試文字</p> </div> </div> <div class="item"> <div class="item_img"> <img src="cast.png" alt="Testing Demo Project pic"> </div> <div class="item_content"> <h3>LinuxCast測試標題測試標題</h3> <p class="item_info">作者:XXX 發表於:2017年7月15號</p> <p class="item_desc">LinuxCast測試內容測試內容測試內容測試文字測<br> 測試文字測試文字測試文字測試文字測試文字測試文字</p> </div> </div> <div class="item"> <div class="item_img"> <img src="cast.png" alt="Testing Demo Project pic"> </div> <div class="item_content"> <h3>LinuxCast測試標題測試標題</h3> <p class="item_info">作者:XXX 發表於:2017年7月15號</p> <p class="item_desc">LinuxCast測試內容測試內容測試內容測試文字測<br> 測試文字測試文字測試文字測試文字測試文字測試文字</p> </div> </div> <div class="item"> <div class="item_img"> <img src="cast.png" alt="Testing Demo Project pic"> </div> <div class="item_content"> <h3>LinuxCast測試標題測試標題</h3> <p class="item_info">作者:XXX 發表於:2017年7月15號</p> <p class="item_desc">LinuxCast測試內容測試內容測試內容測試文字測<br> 測試文字測試文字測試文字測試文字測試文字測試文字</p> </div> </div> </div> <div class="side"> <div class="author_info"> <div class="author_img"> <img src="author.jpg" alt="Testing Demo project pic"> </div> <div class="author_desc"> <h4>Double Sweet</h4> <p>emmm..<br> emmmmmmmm...</p> </div> </div> <div class="top_article"> <h4>推薦文章</h4> <ul> <li>好文要頂-1</li> <li>好文要頂-2</li> <li>好文要頂-3</li> <li>好文要頂-4</li> <li>好文要頂-5</li> </ul> </div> <div class="site-info"> <p>訪客:555555</p> <p>文章:666篇</p> </div> </div> <div class="clear"></div> </div> <div id="footer"> <div class="site_about"> <p>2015-2017 CopyRight LinuxCast.net Demo Site</p> </div> <div class="site_link"> <ul> <li><a href = "">關於我們</a></li> <li><a href = "">聯絡我們</a></li> <li><a href = "">使用條款</a></li> <li><a href = "">意見反饋</a></li> </ul> </div> <div class="clear"></div> </div> <script src="lib/jquery-2.1.1.min.js"></script> <script src="lib/bootstrap/js/bootstrap.min.js"></script> </body> </html>
//CSS
body{ background-image: url("bg.jpg"); } a{ color: grey;/*背景顏色*/ text-decoration: none;/*去除文字的下劃線*/ } #head{ width: 960px; margin: auto; border-bottom: dotted 1px white; /*設定了白色的分界線*/ margin-bottom: 10px; } .logo_title{ float: left; } .logo_title h1{ font-size: 30px; color: white; } .logo_title h2{ font-size: 20px; color: white; } .navi{ float: right; } .navi ul{ list-style: none;/*去除前面的黑點*/ margin-top: 75px; } .navi ul li{ display: inline-block;/*排列方式,排列到一行*/ font-size: 20px; color: white;/*寫不寫都可以*/ margin-right: 20px;/*外填充距離*/ } .navi ul li a{ color: white; border:solid 1px white;/*白色的方框*/ border-radius: 6px;/*邊角設定弧度*/ padding: 4px;/*上下內填充*/ padding-left: 14px;/*左內邊距*/ padding-right: 14px;/*右內邊距*/ } .clear{ clear: both; } #wrapper{ margin: auto; width: 960px; margin-top: 20px; } .main{ width: 640px; background-color: white; float: left; margin-right:10px; padding: 20px; border-radius: 4px; } .item{ margin-top: 14px; padding-bottom: 20px; border-bottom: dotted 1px #999; } .item_img{ float: left; width: 100px; } .item_img img{ width: 80px; } .item_content{ /*padding-left: 100px;*/ /*float: right;*/ margin-bottom: 10px; } .item_content h3{ font-size: 14px; color: #FF6347; margin: 0; } .item_info{ font-size: 12px; font-style: italic; margin:0; color: #999; } .item_desc{ font-size: 14px; margin: 0; color: gray; margin-top:10px; /*與h2有一定的邊距*/ border-left: solid 1px #ccc;/*設定左邊框*/ padding-left: 10px;/*設定左填充*/ } .side{ width: 220px; background-color: white ; float: right; padding: 20px; border-radius: 6px; margin-left: 10px; height: 450px; } .author_img{ margin-top: 20px; width: 120px; margin:auto; } .author_img img{ width: 120px; border:solid 1px #ccc; border-radius: 4px; } .author_desc{ text-align: center; border:solid 1px #ccc; border-radius: 4px; background-color: #eee; padding-top:10px; padding-bottom: 10px; margin-top: 10px; margin-bottom: 10px; } .author_desc h4{ margin:0; margin-bottom: 10px; } .author_desc p{ margin:0; font-size: 14px; margin-bottom: 10px; } .top_article h4{ font-size:14px; font-style: italic; margin:0; border-bottom: dotted 1px #999; border-top: 10px; } .top_article ul{ margin-left:0; padding-left:10px; list-style: none; } .top_article ul li{ margin:0; font-size: 14px; margin-top: 5px; } /*.site_info{ margin-top: 30px; border-top: solid 1px #ccc; } .site_info p{ font-size: 14px; color: gray; margin:0; padding-left: 60px; margin-top: 10px; }*/ .site-info{ margin-top: 30px; border-top: solid 1px #ccc;/*分界線*/ } .site-info p{ font-size: 14px; color: gray; text-align: center; /*padding-left: 60px;/*左填充*/ margin:0; margin-top: 10px; } #footer{ margin: auto; width: 960px; border-top: dotted 1px #ccc; margin-top: 20px; } .site_about{ float: left; padding-top: 15px; } .site_about p{ font-size: 16px; color: white; } .site_link{ float: right; } .site_link ul{ list-style: none; margin-top: 30px; } .site_link ul li{ display: inline-block; font-size: 14px; margin-right: 10px; color: white; } .site_link ul li a{ border-radius: 6px; border:solid 1px white; padding: 4px; padding-left: 10px; padding-right: 10px; color: white; }