標籤:
一、邊框屬性
1、border:複合屬性。設定對象邊框的特性。
取值:
border-width: 設定或檢索對象邊框寬度。
border-style: 設定或檢索對象邊框樣式。
border-color: 設定或檢索對象邊框顏色。
#border4 { width: 100px; height: 100px; border:1px solid #FF0000; }
<div id="border4"></div>
2、border-width:設定對象的邊框寬度。
取值:
meadium: 定義預設厚度的邊框
thin: 定義比預設厚度細的邊框。
thick: 定義比預設厚度粗的邊框。
★ 如果提供全部四個參數值,將按上、右、下、左的順序作用於四邊。
如果只提供一個,將用於全部的四邊。
如果提供兩個,第一個用於上、下,第二個用於左、右。
如果提供三個,第一個用於上,第二個用於左、右,第三個用於下。
也可以分別對四邊設定邊框:
border-top-width 設定上邊框寬度
border-bottom-width 設定下邊框寬度
border-left-width 設定左邊框寬度
border-right-width 設定右邊框寬度
<style> #border1{ width:200px; height:100px; border:solid; /*border-width: 5px;*/ border-width:2px 3px 4px 5px ; }</style>
<div id="border1"></div>
3、border-color:設定或檢索對象的邊框顏色
取值:
(1)英文單詞的顏色,如“blue”、“red”
(2)十六進位值,如“#ffffff”、“#ff0000”
(3)rgba、rgb,如rgba(0,0,0,.5)、rgb(255,255,255)
<style> #border2 { width: 200px; height: 100px; border: solid; border-color: #FF0000; }</style>
<body> <div id="border2"></div> </body>
4、border-style:設定對象的邊框樣式
取值:
none:無輪廓。border-color與border-width將被忽略
hidden:隱藏邊框。IE7及以下尚不支援
dotted:點狀輪廓。IE6下顯示為dashed效果
dashed:虛線輪廓。
solid: 實線輪廓。
double:雙線輪廓。兩條單線與其間隔的和等於指定的border-width值
可以對四邊分別設定其邊框樣式:
#border3 { width: 200px; height: 100px; border: solid; border-top-style:dotted ; border-left-style:dashed ; border-right-style: double; border-bottom-style: solid; }
<div id="border3"></div>
5、border-radius:設定對象使用圓角邊框
- 水平半徑:如果提供全部四個參數值,將按上左(top-left)、上右(top-right)、下右(bottom-right)、下左(bottom-left)的順序作用於四個角。
- 如果只提供一個,將用於全部的於四個角。
- 如果提供兩個,第一個用於上左(top-left)、下右(bottom-right),第二個用於上右(top-right)、下左(bottom-left)。
- 如果提供三個,第一個用於上左(top-left),第二個用於上右(top-right)、下左(bottom-left),第三個用於下右(bottom-right)。
取值
length:用長度值設定對象的圓角半徑長度。不允許負值
-
percentage:用百分比設定對象的圓角半徑長度。不允許負值
-
CSS代碼#yj{ background-color:indianred ; width: 100px; height: 100px; border-radius: 10px 10px 20px 20px; }HTML代碼:<div id="yj"> </div>
-
CSS常用樣式(二)