CSS3【border-radius】製作半圓

來源:互聯網
上載者:User

標籤:color   linear   omr   製作   idt   如何   isp   log   png   

1.利用css如何製作一個半圓?(思路:對樣式border-radius以及寬高的控制)

div{    display: inline-block;    border:1px solid #6baabb;    width:40px;    height:40px;    float:left;    margin:0px 10px;}a{    display: inline-block;    width:40px;    height:40px;    background: #6baabb;}.Round{/*圓*/    border-radius:20px;}.LeftRound{/*左半圓*/    width:20px;    border-radius:20px 0px 0px 20px;}.RightRound{/*右半圓*/    width:20px;    border-radius:0px 20px 20px 0px;}.TopRound{/*上半圓*/    height:20px;    border-radius:20px 20px 0px 0px;}.BottomRound{/*下半圓*/    height:20px;    border-radius:0px 0px 20px 20px;}

頁面部分

<div><a class="Round"></a></div><div><a class="LeftRound"></a></div><div><a class="RightRound"></a></div><div><a class="TopRound"></a></div><div><a class="BottomRound"></a></div>

效果:

 

2.即當a標籤內有內容時,無法再對a標籤進行寬高的控制,但又不想引入圖片作為背景,此時用css3漸層屬性linear-gradient
(思路:一個圓,將自己不需要顯示的半圓用白色背景)  

background:linear-gradient(to top, #fff 0%, #fff 45% ,#6baabb 50%,#6baabb); /*上半圓*/background:linear-gradient(to bottom, #fff 0%, #fff 45% ,#6baabb 50%,#6baabb); /*下半圓*/

效果展示:

 

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.