CSS border style
CSS border style
You can use border-style to set the border style, or you can set the top, bottom, left, and right styles separately:
border- top-style
border-left-style
border-right-style
border -bottom-style
There are many kinds of border styles, which can be defined, such as single border, dotted border, solid border, double border, and border without border.
<html> <head> <title>測試內(nèi)邊距</title> <meta charset="utf-8"> <!-- 調(diào)用CSS樣式表 --> <style type="text/css"> p.none{border-style: none;}/*設(shè)置無邊的邊框*/ p.dotted {border-style: dotted}/*設(shè)置點狀邊框*/ p.dashed {border-style: dashed}/*設(shè)置虛線邊框*/ p.solid {border-style: solid}/*設(shè)置實線邊框*/ p.double {border-style: double}/*設(shè)置雙線邊框*/ p.groove {border-style: groove}/*設(shè)置3D凹槽邊框*/ p.ridge {border-style: ridge}/*設(shè)置3D壟狀邊框*/ p.inset {border-style: inset}/*設(shè)置3D inset 邊框*/ p.outset {border-style: outset}/*設(shè)置3D outset 邊框*/ </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">3D凹槽邊框</p> <p class="ridge">3D 壟狀邊框</p> <p class="inset">3D inset 邊框</p> <p class="outset"> 3D outset 邊框</p> </body> </html>
CSS border width and color
Border width
The border width is defined by border-width, which can be set up, down, left and right respectively. Properties
border-top-width
border-bottom-width
border-left-width
border-right-width
Border color
The border width is defined by border-color, and the upper and lower sides can also be set separately Left and right 4 attributes
border-top-color
border-bottom-color
border-left -color
border-right-color
<!DOCTYPE html> <html> <head> <title>測試內(nèi)邊距</title> <meta charset="utf-8"> <!-- 調(diào)用CSS樣式表 --> <style type="text/css"> /*定義p標簽,是實線邊框*/ p {border-style: solid;} .all { /*定義所有邊框?qū)挾葹?像素*/ border-width: 5px; /*定義所有邊框是顏色為橙色*/ border-color: #FF8000 } .top { /*定義上邊框?qū)挾葹?像素*/ border-top-width: 5px; /*定義上邊框是顏色為橙色*/ border-top-color: #FF8000 } .bottom { /*定義下邊框?qū)挾葹?像素*/ border-bottom-width: 5px; /*定義下邊框是顏色為橙色*/ border-bottom-color: #FF8000 } .left { /*定義左邊框?qū)挾葹?像素*/ border-left-width: 5px; /*定義左邊框是顏色為橙色*/ border-left-color: #FF8000 } .right { /*定義右邊框?qū)挾葹?像素*/ border-right-width: 5px; /*定義右邊框是顏色為橙色*/ border-right-color: #FF8000 } </style> </head> <body> <p class="all">我是設(shè)置所有邊框的</p> <p class="top">我只負責上面</p> <p class="bottom">我負責下面</p> <p class="left">我設(shè)置的是左邊</p> <p class="right">我設(shè)置的是右邊</p> </body> </html>
Set each border individually
In CSS, you can specify different borders on different sides:
Example
p
{
border-top-style:dotted;
border -right-style:solid;
border-bottom-style:dotted;
border-left-style:solid;
}
above Examples can also set a single attribute:
border-style:dotted solid;
The border-style attribute can have 1- 4 values:
border-style: dotted solid double dashed;
The upper border is dotted
The right border is solid
The bottom border is double
The left border is dashed
border-style:dotted solid double;
The top border is dotted
The left and right borders are solid
The bottom border is double
border-style:dotted solid;
The top and bottom borders are dotted
The right and left borders are solid
border-style:dotted;
The four-sided borders are dotted
The border also has the abbreviation attribute
border: 5px solid red;