首页 > Web开发 > 详细

css3边框

时间:2016-01-08 18:46:52      阅读:313      评论:0      收藏:0      [点我收藏+]

border属性是css盒子模型基础属性之一。

css2中border的属性

  • border-width 边线宽度
  • border-style 边框类型(必须有)
  • border-color 边框颜色

css3中添加的border属性

  • border-color
  • border-image
  • border-radius
  • border-shadow

一、 border-radius

  兼容性:IE9+、Firefox 4+、Chrome、Safari 5+ 以及 Opera 支持 border-radius 属性。

  语法:

border-radius: none | <length>{1,4} [/ <length>{1,4}] ?

 解析:

  四个值的顺序为:top-left、top-right、bottom-right、bottom-left(即顺时针顺序)

  如果反斜杠‘/‘存在,若‘/‘存在,则前面的值设置为元素圆角的水平半径,后面的值为垂直方向的半径

     如果不存在,则圆角的水平方向的半径和垂直方向的半径相等。

     length设置的主要有如下四个场景:

  •   border-radius:length{1}  top-left、top-right、bottom-right、bottom-left四个值相等。
  •   border-radius: length{2}  top-left、bottom-right取第一个值,top-right、bottom-left取第二个值。
  •   border-radius: length{3}  top-left第一个值,top-right、bottom-left 第二个值 ,bottom-right第三个值
  •   border-radius: length{4}  top-left第一个值,top-right 第二个值 ,bottom-right第三个值,bottom-left第四个值

  none: 默认值,表示没有圆角

  派生出来的子属性:

  border-top-left-radius: <length> [<length>]?

  border-top-right-radius: <length> [<length>]?

  border-bottom-right-radius: <length> [<length>]?

  border-bottom-left-radius: <length> [<length>]?

  实例:

  不规则圆角边框

.radius{
    background:#ddd;
    width:300px;
    height:300px;
    border-radius:100px 80px 60px 40px / 50px 40px 30px 20px;
}

  效果如下 :

技术分享

 

  只设置左上圆角:

  

.radius{
    background:#ddd;
    width:300px;
    height:300px;
    border-top-left-radius:150px 70px;
}

  效果如下:

技术分享

  圆形

  

.radius{
    background:#ddd;
    width:300px;
    height:300px;
    border-radius:150px;
}

  技术分享

  半圆形

  

.radius{
    background:#ddd;
    width:300px;
    height:150px;
    border-radius:0 0 150px 150px;
}

  技术分享

  扇形

  

.radius{
    background:#ddd;
    width:150px;
    height:150px;
    border-bottom-left-radius:150px;
}

 技术分享

 

  椭圆

  

.radius{
    background:#ddd;
    width:300px;
    height:150px;
    border-radius:150px / 75px;
}

   

 

 

css3边框

原文:http://www.cnblogs.com/sanbao/p/5114010.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!