使用css和html模仿搜狐頁面

來源:互聯網
上載者:User

標籤:css   html   介面   

最近在有學習了下css+html,利用css+html寫模仿寫下了搜狐布局的一部分

首先建立一個html檔案,命名為sohu.html

代碼如下:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html>  <head>    <title>sohu.html</title>    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">    <meta http-equiv="description" content="this is my page">    <meta http-equiv="content-type" content="text/html; charset=UTF-8">       <link rel="stylesheet" type="text/css" href="./sohu.css">  </head>    <body>  <!--最上面的div  -->    <div class="top">      <div class="login">登入部分</div>      <div class="indexpage">設為首頁</div>      <div class="myhref">超連結</div>    </div>    <!--logo div  -->    <div class="logo"><img src="sohu1.jpg"/></div>    <div class="navi">導覽列</div>    <!-- 廣告部分 -->    <div class="ad">      <div class="stuad">招生廣告</div>      <div class="ad2">廣告2</div>      <div class="housead">房地產廣告</div>           <div class="picad">      <table height="100%" aligin="center" valign="middle">      <tr>      <td>      <img src="car2.jpg">      </td>      </tr>      </table>      </div>    </div>  </body></html>


在寫css檔案:

</pre><pre name="code" class="css">body{width:950px;/*高度定不下來不要寫,自己適應  */margin:0 auto;/* background-color: pink; */border:1px solid red;font-size: 12px;}.top{width:950px;height:22px;background-color: pink;}/*登入部分  */.login{width:416px;height:22px;background-color: green;float:left;}/*設為首頁  */.indexpage{width:105px;height:20px;background-color: gray;float:left;margin-left: 80px;}/* 超連結 */.myhref{width:250px;height:20px;float:right;background-color: #b4b4b4;}/* logo */.logo{width:137px;height:68px;float:left;background-color: yellow;margin-top: 5px;}.logo img{width:137px;}/*導覽列  */.navi{width:807px;height:68px;float:left;background-color: #7CE574;margin-top:5px;margin-left: 5px;}/*廣告部分  */.ad{width:950px;height:212px;background-color: pink;margin-top: 5px;float:left;border:1px solid silver;}/*學生廣告  */.stuad{width:126px;height:196px;background-color: #EC7E8C;float:left;margin:5px 0 0 5px;}/*廣告2  */.ad2{width:453px;height:196px;margin:5px 0 0 15px;background-color: #EC7E8C;float:left;}/* 房地產廣告 */.housead{height:196px;width:150px;background-color: #7CE574;margin:5px 0 0 12px;float:left;}/* 圖片廣告 */.picad{height:212px;width:180px;float:right;background-color: #7CE574;border-left: 1px solid silver;text-align: center;}運行後介面為:




本文原創,轉載請註明:http://blog.csdn.net/j903829182/article/details/38732321










聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.