CSS常用樣式(二)

來源:互聯網
上載者:User

標籤:

一、邊框屬性

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常用樣式(二)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.