CSS邊框樣式
阿新 • • 發佈:2021-01-09
CSS邊框樣式
邊框隨處可見,幾乎可以對所有元素設定邊框。
屬性 | 說明 |
---|---|
border-width | 邊框寬度 |
border-style | 邊框的外觀 |
border-color | 邊框顏色 |
1.整體樣式
1)寬度
畫素值
2)外觀
none 無樣式
dashed 虛線
solid 實線
3)顏色
關鍵字/16進位制RGB值
4)簡寫
border:1px solid red;
2.區域性樣式
簡寫,把整體樣式中的border換成border-top,border-bottom,border-left,border-right,
例子:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<style type="text/css">
div
{
width: 100px; /*div元素寬為100px*/
height: 60px; /*div元素高為60px*/
border-top : 2px solid teal; /*上邊框樣式*/
border-right: 2px solid yellow; /*右邊框樣式*/
border-bottom: 2px solid blue; /*下邊框樣式*/
border-left: 2px solid green; /*左邊框樣式*/
}
</style>
</head>
<body>
<div></div>
</body>
</ html>
效果: