HTML布局-1.20HTML基礎(chǔ)教程

網(wǎng)站常常以多列顯示內(nèi)容(就像雜志和報紙)。

創(chuàng)新互聯(lián)成立于2013年,是專業(yè)互聯(lián)網(wǎng)技術(shù)服務(wù)公司,擁有項目網(wǎng)站建設(shè)、成都網(wǎng)站建設(shè)網(wǎng)站策劃,項目實施與項目整合能力。我們以讓每一個夢想脫穎而出為使命,1280元永年做網(wǎng)站,已為上家服務(wù),為永年各地企業(yè)和個人服務(wù),聯(lián)系電話:13518219792

City Gallery
London

London is the capital city of England. It is the most populous city in the United Kingdom, with a metropolitan area of over 13 million inhabitants.

Standing on the River Thames, London has been a major settlement for two millennia, its history going back to its founding by the Romans, who named it Londinium.

使用 <div> 元素的 HTML 布局

注釋:<div> 元素常用作布局工具,因為能夠輕松地通過 CSS 對其進(jìn)行定位。

這個例子使用了四個 <div> 元素來創(chuàng)建多列布局:

實例 <body><div id="header"><h1>City Gallery</h1></div><div id="nav">London<br>Paris<br>Tokyo<br></div><div id="section"><h1>London</h1><p>London is the capital city of England. It is the most populous city in the United Kingdom,with a metropolitan area of over 13 million inhabitants.</p><p>Standing on the River Thames, London has been a major settlement for two millennia,its history going back to its founding by the Romans, who named it Londinium.</p></div><div id="footer">Copyright W3School.com.cn</div></body> CSS: <style>#header { background-color:black; color:white; text-align:center; padding:5px;}#nav { line-height:30px; background-color:#eeeeee; height:300px; width:100px; float:left; padding:5px; }#section { width:350px; float:left; padding:10px; }#footer { background-color:black; color:white; clear:both; text-align:center; padding:5px; }</style>
使用 HTML5 的網(wǎng)站布局

HTML5 提供的新語義元素定義了網(wǎng)頁的不同部分:

HTML5 語義元素 header 定義文檔或節(jié)的頁眉 nav 定義導(dǎo)航鏈接的容器 section 定義文檔中的節(jié) article 定義獨立的自包含文章 aside 定義內(nèi)容之外的內(nèi)容(比如側(cè)欄) footer 定義文檔或節(jié)的頁腳 details 定義額外的細(xì)節(jié) summary 定義 details 元素的標(biāo)題

這個例子使用 <header>, <nav>, <section>, 以及 <footer> 來創(chuàng)建多列布局:

實例 <body><header><h1>City Gallery</h1></header><nav>London<br>Paris<br>Tokyo<br></nav><section><h1>London</h1><p>London is the capital city of England. It is the most populous city in the United Kingdom,with a metropolitan area of over 13 million inhabitants.</p><p>Standing on the River Thames, London has been a major settlement for two millennia,its history going back to its founding by the Romans, who named it Londinium.</p></section><footer>Copyright W3School.com.cn</footer></body> CSS <style>header { background-color:black; color:white; text-align:center; padding:5px; }nav { line-height:30px; background-color:#eeeeee; height:300px; width:100px; float:left; padding:5px; }section { width:350px; float:left; padding:10px; }footer { background-color:black; color:white; clear:both; text-align:center; padding:5px; }
使用表格的 HTML 布局

注釋:<table> 元素不是作為布局工具而設(shè)計的。

<table> 元素的作用是顯示表格化的數(shù)據(jù)。

使用 <table> 元素能夠取得布局效果,因為能夠通過 CSS 設(shè)置表格元素的樣式:

實例 <body><table class="lamp"><tr> <th> <img src="/images/lamp.jpg" alt="Note" style="height:32px;width:32px"> </th> <td> The table element was not designed to be a layout tool. </td></tr></table></body> CSS <style>table.lamp { width:100%; border:1px solid #d4d4d4;}table.lamp th, td { padding:10px;}table.lamp td { width:40px;}</style>

文章題目:HTML布局-1.20HTML基礎(chǔ)教程
本文URL:http://www.muchs.cn/article27/dghhdcj.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供用戶體驗品牌網(wǎng)站建設(shè)、App開發(fā)、網(wǎng)站設(shè)計公司外貿(mào)網(wǎng)站建設(shè)、網(wǎng)站設(shè)計

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都app開發(fā)公司