使用圓角邊框(border-radius)這個屬性
用法:
圓角邊框的基本用法就是設置四個相同弧度的圓角
boder-top-left-radius:30px; 左上角
boder-top-right-radius:30px; 右上角
boder-bottom-left-radius:30px; 左下角
boder-bottom-right-radius:30px; 右下角
.div1{
margin: 0 auto;
background: darkcyan;
width: 200px;
height: 200px;
border: 2px solid darkslategray;
border-radius: 30px;
text-align: center;
line-height: 200px;
}
圓角邊框也可以使用百分比作為單位,例如,把一個圓角邊框設置為50%,就會變成一個圓,但是百分比大于50%之后,形狀就不會變化了。
例子:
css
.box{
width: 200px;
height: 200px;
margin: 30px solid red;
background: bluesky;
border-radius: 50%;
}
html
<div class:"box"></div>
使用圓角邊框也可以畫出一個橢圓
css
.div{
width: 200px;
height: 300px;
border: 2px solid yellow;
background: bluesky;
border-radius: 100px 150px;
}
html
<div class:"div"></div>
遠近互聯前端小王整理發布,希望能對學習技術的你有所幫助
遠近互聯專業提供網站建設、APP開發、網站優化、外貿網站SEO、微信運營的品牌整合營銷服務讓客戶通過網絡品牌建立與網絡傳播提高業績。






