1. 程式人生 > >css盒子模型之邊框

css盒子模型之邊框

oct document width itl bottom HA text 屬性 顏色

 1 <!DOCTYPE html>
 2 <html lang="en">
 3 <head>
 4     <meta charset="UTF-8">
 5     <title>Document</title>
 6     <style type="text/css">
 7         .box{
 8             width:300px;
 9             height: 390px;
10             background-color:pink;
11              border-top-style
:solid;/* 線型 */ 12 border-top-color:red;/* 上邊框顏色 */ 13 border-top-width:5px;/* 上邊框粗細 */ 14 15 border-bottom-style:dotted;/* 點線 */ 16 border-bottom-color:blue; 17 border-left-style:dashed;/* 虛線 */ 18 border-left-color:#467890; 19 /*
四個邊框都一樣 */ 20 border:5px solid blue; 21 } 22 </style> 23 </head> 24 <body> 25 <div class="box">距離</div> 26 </body> 27 </html>

css盒子模型:
1.邊框 border
border-top-style(線型):solid(實線)
         dotted(點線)
         dashed(虛線)
border-top-color(邊框顏色)


border-top-width(邊框粗細)

2.邊框屬性簡寫:
border-top:5px solid red;
特點:沒有順序限制.線型為必寫項
四個邊框相同的時候寫法:
border:5px solid red
特點:沒有順序要求。線型為必寫項

css盒子模型之邊框