CSS3邊框 圓角效果 border-radius

來源:互聯網
上載者:User

標籤:ges   height   www   size   radius   class   html   ack   bsp   

 border-radius是向元素添加圓角邊框

使用方法:

border-radius:10px; /* 所有角都使用半徑為10px的圓角 */ 

border-radius: 5px 5px 5px 5px; /* 四個半徑值分別是左上方、右上方、右下角和左下角,順時針 */ 

不要以為border-radius的值只能用px單位,你還可以用百分比或者em,但相容性目前還不太好。

實心上半圓:

方法:把高度(height)設為寬度(width)的一半,並且只設定左上方和右上方的半徑與元素的高度一致(大於也是可以的)。

div{    height:50px;/*是width的一半*/    width:100px;    background:#9da;    border-radius:50px 50px 0 0;/*半徑至少設定為height的值*/    }

實心圓:
方法:把寬度(width)與高度(height)值設定為一致(也就是正方形),並且四個圓角值都設定為它們值的一半。如下代碼:

div{    height:100px;/*與width設定一致*/    width:100px;    background:#9da;    border-radius:50px;    }

實心下半圓:

方法:把高度(height)設為寬度(width)的一半,並且只設定左下角和右下角的半徑與元素的高度一致(大於也是可以的)。

div.circle2{
height:50px;
width:100px;
background:#9da;
border-radius:0 0 50px 50px;
}

實心左半圓:

方法:把寬度(width)設為高度(height)的一半,並且只設定左上方和左下角的半徑與元素的高度一致(大於也是可以的)。

div.circle2{
height:50px;
width:100px;
background:#9da;
border-radius:50px 0 0 50px;
}

執行個體右半圓:

方法:把寬度(width)設為高度(height)的一半,並且只設定右上方和右下角的半徑與元素的高度一致(大於也是可以的)。

div.circle2{
height:50px;
width:100px;
background:#9da;
border-radius:0 50px 50px 0;
}
代碼示範:
<!doctype html><html><head>    <meta charset="utf-8">    <title>border-radius</title>    <style type="text/css">        div.circle{            height:50px;/*是width的一半*/            width:100px;            background:#9da;            border-radius:50px 50px 0 0;/*半徑至少設定為height的值*/        }        div.circle1{            height:100px;/*與width設定一致*/            width:100px;            background:#9da;            border-radius:50px;        }        div.circle2{            height:50px;            width:100px;            background:#9da;            border-radius:0 0 50px 50px;        }        div.circle3{            height:100px;            width:50px;            background:#9da;            border-radius:50px 0 0 50px;        }        div.circle4{            height:100px;

width:50px; background:#9da; border-radius:0px 50px 50px 0px; } </style></head><body><div class="circle"></div><br/><div class="circle1"></div><br><div class="circle2"></div><br><div class="circle3"></div><br><div class="circle4"></div><br></body></html>

轉載:http://www.imooc.com/code/380



CSS3邊框 圓角效果 border-radius

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.