2008-09-19 57 views
2

我需要一些關於如何使用邊距的信息以及填充的工作原理。關於如何使用邊距的信息

例如:我應該放一條線佔據頁面的整個寬度(無論使用什麼分辨率來顯示網頁),只要在每一邊放一個小邊框,我怎麼能實現這一點?

回答

9

看一看這樣的:http://redmelon.net/tstme/box_model/

基本上,一個元素組成的內容,其填充,然後邊框,則邊緣包圍。背景圖像只能延伸到邊界。邊距最好被描述爲「圍繞這個元素的空白」。

但看看上面的網址,讓自己成爲一個測試頁面來玩,應該都是有道理的。

0

我想這應該做你想要什麼:

<table width="100%" cellpadding="5"> 
    <tr> 
    <td> 
One, two, three ... One, two, three ... One, two, three ... One, two, three ... One, two, three ... One, two, three ... One, two, three ... One, two, three ... One, two, three ... 
    </td> 
    </tr> 
</table> 

設置寬度爲「100%」強制文本使用全寬度和設置的cellpadding爲「5」設定的5個像素的unvisible邊界。

+0

填充不是html屬性。你可能正在考慮cellpadding ..? – Dan 2008-09-19 19:20:04

0

另一種說明方法是在框模型中,填充是盒子邊緣內側的「邊距」是盒子周圍的緩衝區。