css3圆角

1.1border-radius 属性

border-radius 属性,可以给任何元素制作 圆角
div {
width: 200px;
height: 150px;
padding: 20px;
}
.radius1 {
color: white;
background: green;
border-radius: 25px;
}
.radius2 {
border-radius: 25px;
border: 2px solid green;
}
.radius3 {
border-radius: 25px;
background: url('img/paper.gif');
background-position: left top;
background-repeat: repeat;
}

效果:

 

1.2指定每个圆角

CSS 拥有用于为元素的每个角指定圆角的属性:
  • border-radius: 15px 50px 30px 5px; :左上角为15px,右上角为50px,右下角为30px,左下角为5px
  • border-radius: 15px 50px 30px; :左上角为15px,右上角和左下角为50px,右下角为30px
  • border-radius: 15px 50px; :左上角和右下角为15px,右上角和左下角为50px
  • border-radius: 15px; :四个角都是15px
.radius4 {
color: white;
background: green;
border-radius: 15px 50px 30px 5px;
}
.radius5 {
color: white;
background: green;
border-radius: 15px 50px 30px;
}
.radius6 {
color: white;
background: green;
border-radius: 15px 50px;
}
.radius7 {
color: white;
background: green;
border-radius: 15px;
}
效果:

 

 1.3椭圆边角

.radius8 {
color: white;
background: green;
border-radius: 50px/15px;
}
.radius10 {
color: white;
background: green;
border-radius: 50%;
}
效果:

 

 

1.4圆形边角

我们经常需要使用圆角来显示用户头像:
.avatar {
width: 200px;
height: 200px;
display: inline-block;
border-radius: 50%;
background: url('img/avatar.jpg');
background-size: contain;
}
效果:

 

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值