起始標籤 | 結束標籤 |
---|---|
需要 | 需要 |
<div> 有幾個屬性
屬性 | 值 | Deprecated or Obsolete |
---|---|---|
align | left center right justify | HTML 4 only, Obsolete in HTML 5 |
舉例如下
<html> <head> <title>網頁標題</title> </head> <body> <div>You ever have that feeling where you're not sure if you're awake or still dreaming?</div> <div>A prison for your mind.</div> <div>Free your mind.</div> <div>Believe the unbelievable.</div> <div>There is no spoon.</div> <div>I can only show you the door, you have to walk through it.</div> <div>Choice. The problem is choice.</div> Then tomorrow we may all be dead, but how would that be different from any other day? I have dreamed a dream, but now that dream has gone from me. Choice is an illusion, created between those with power, and those without. Because I choose to. Everything that has a beginning has an end. </body> </html> <!-- 《程式語言教學誌》的範例程式 http://pydoing.blogspot.com/ 檔名:textexample64.html 功能:示範 HTML 4.01 標記語言的使用 作者:張凱慶 時間:西元 2011 年 5 月 -->
利用瀏覽器 (broswer) 開啟,結果如下
我們可以看到使用 <div> 標記的文字都是獨立的段落,每個 <div> 元素 (element) 結束都像有個 <br />,沒有用 <div> 標記的文字則是統統擠在一起。
另有一個與 <div> 具有類似功能的 <p> 標籤,兩者比較如下
<html> <head> <title>網頁標題</title> </head> <body> <p>You ever have that feeling where you're not sure if you're awake or still dreaming?</p> <p>A prison for your mind.</p> <p>Free your mind.</p> <p>Believe the unbelievable.</p> <p>There is no spoon.</p> <p>I can only show you the door, you have to walk through it.</p> <p>Choice. The problem is choice.</p> <div>Then tomorrow we may all be dead, but how would that be different from any other day?</div> <div>I have dreamed a dream, but now that dream has gone from me.</div> <div>Choice is an illusion, created between those with power, and those without.</div> <div>Because I choose to.</div> <div>Everything that has a beginning has an end.</div> </body> </html> <!-- 《程式語言教學誌》的範例程式 http://pydoing.blogspot.com/ 檔名:textexample31.html 功能:示範 HTML 4.01 標記語言的使用 作者:張凱慶 時間:西元 2011 年 5 月 -->
同樣用瀏覽器開啟,如下
這裡, <p> 並沒有像 <div> 一樣,反而是與其它元素間有間隔一行。
中英文術語對照 | |
---|---|
區塊元素 | block element |
區塊 | block |
瀏覽器 | broswer |
標籤 | tag |
您可以繼續參考
相關目錄
HTML 4.01 快速導覽 - 目錄
HTML, CSS 教材
首頁
參考資料
沒有留言:
張貼留言