設定邊框樣式登入

設定邊框樣式

border-style屬性設定一個元素的四個邊框的樣式。此屬性可以有一到四個值。

範例:

border-style:dotted solid double dashed;

 ●  上邊框是點狀

 ●  右框是實線

 ●  下邊框是雙線

 ●  左邊框框是虛線

border-style:dotted solid double;

 ●上方邊框是點狀

 ●  右邊框框與左邊框是實線

 ●  下邊框是雙線

#
border-style:dotted solid;

 ●  上邊框和下邊框是點狀

 ●  右邊方塊和左邊框是實線

#
border-style:dotted;

# ●  所有4個邊框都是點狀

可以設定的屬性值:

none:定義無邊框。   

hidden:與 "none" 相同。不過應用於表時除外,對於表,hidden 用於解決邊框衝突。   

dotted:定義點狀邊框。在大多數瀏覽器中呈現為實線。

dashed:定義虛線。在大多數瀏覽器中呈現為實線。

solid:定義實線。

double:定義雙線。雙線的寬度等於 border-width 的值。

groove:定義 3D 凹槽邊框。其效果取決於 border-color 的值。

ridge:定義 3D 壟狀邊框。其效果取決於 border-color 的值。

inset:定義 3D inset 邊框。其效果取決於 border-color 的值。

outset:定義 3D outset 邊框。其效果取決於 border-color 的值。

inherit:規定應該從父元素繼承邊框樣式。

下一節
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>设置边框样式</title> <style> p.none {border-style:none;} p.dotted {border-style:dotted;} p.dashed {border-style:dashed;} p.solid {border-style:solid;} p.double {border-style:double;} p.groove {border-style:groove;} p.ridge {border-style:ridge;} p.inset {border-style:inset;} p.outset {border-style:outset;} p.hidden {border-style:hidden;} </style> </head> <body> <p class="none">无边框。</p> <p class="dotted">虚线边框。</p> <p class="dashed">虚线边框。</p> <p class="solid">实线边框。</p> <p class="double">双边框。</p> <p class="groove"> 凹槽边框。</p> <p class="ridge">垄状边框。</p> <p class="inset">嵌入边框。</p> <p class="outset">外凸边框。</p> <p class="hidden">隐藏边框。</p> </body> </html>
章節課件