學習網頁編程(一)

來源:互聯網
上載者:User

 

    給定一個網頁,首先要分析網頁的布局,一般情況下一個網頁可以概括的分為四部分:

    1. header(標題列),

    2.  nav(導覽列),

    3. content(內容),

    4. footer(頁尾)

給定一個網頁的結構圖如下:

  以上結構用html實現如下:

<div id="header">header</div>
<div id="nav">nav</div>
<div id="content">content</div>
<div id="footer">footer</div>

 

具體的樣式用CSS實現,這樣會使得html代碼簡潔清晰。

CSS實現代碼

<style type="text/css">
html, body
{
height: 100%;
margin: 0;
}

#header
{
width: 96%;
height: 40px;
background: #efdfed;
font-weight: bold;
font-size: 16px;
padding: 15px 0 0 50px;
margin: 0px 2px;
color: Red;
}

#nav
{
width: 96%;
height: 30px;
background: #efdfed;
font-weight: bold;
font-size: 16px;
padding: 12px 0 0 50px;
margin: 5px 2px;
color: Red;
}

#content
{
width: 96%;
height: 42%;
background: #efdfed;
font-size: 16px;
font-weight: bold;
padding: 17% 0 0 50px;
margin: 5px 2px;
color: Red;
}

#footer
{
width: 96%;
height: 30px;
background: #efdfed;
font-weight: bold;
font-size: 16px;
padding: 15px 0 0 50px;
margin: 5px 2px;
color: Red;
}
</style>

 

最後實現的如下

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.