一、官方解释

设置或检索对象使用圆角边框。提供2个参数,2个参数以“/”分隔,每个参数允许设置1~4个参数值,第1个参数表示水平半径,第2个参数表示垂直半径,如第2个参数省略,则默认等于第1个参数。

水平半径:如果提供全部四个参数值,将按上左(top-left)、上右(top-right)、下右(bottom-right)、下左(bottom-left)的顺序作用于四个角。

如果只提供一个,将用于全部的于四个角。

如果提供两个,第一个用于上左(top-left)、下右(bottom-right),第二个用于上右(top-right)、下左(bottom-left)。

如果提供三个,第一个用于上左(top-left),第二个用于上右(top-right)、下左(bottom-left),第三个用于下右(bottom-right)。

垂直半径也遵循以上4点。

对应的脚本特性为borderRadius。

二、例子

2.1 四个参数值

<div style="width: 100px;height: 100px;border:50px solid red;border-radius: 50px;"></div>
 
<div style="width: 100px;height: 100px;border:50px solid red;border-radius: 100px;"></div>
 
<div style="width: 100px;height: 100px;border:50px solid red;border-radius: 50px 100px;"></div>
 
<div style="width: 100px;height: 100px;border:50px solid red;border-radius: 10px 30px 50px 100px;"></div>
 

所以border-radius里面的参数应该代表的是四个角上圆的半径。

2.2 百分比

<div style="width: 100px;height: 100px;border:50px solid red;border-radius: 25%;"></div>
 
<div style="width: 100px;height: 100px;border:50px solid red;border-radius: 50%;"></div>
 

2.3 水平半径/垂直半径

<div style="width: 100px;height: 200px;border:50px solid red;border-radius: 100px/150px;"></div>
 
<div style="width: 100px;height: 200px;border:50px solid red;border-radius: 200px/300px;"></div>
 
<div style="width: 100px;height: 200px;border:50px solid red;border-radius: 200px/200px;"></div>
 

这里的半径全等于本身宽度(width/2)+半径宽度(border-width/2)即为一个椭圆。另外半径最多渲染宽度(width/2)+半径宽度(border-width/2)的值,超过的按比例值来算。

CSS3边框border-radius

最新文章

  1. 算法是什么我记不住,But i do it my way. 解一道滴滴出行秋招编程题。
  2. Redis与KV存储(RocksDB)融合之编码方式
  3. 公众号第三方平台开发 获取 component_verify_ticket 2015-07-05 10:16 59人阅读 评论(0) 收藏
  4. PHP模拟POST请求,获取response内容
  5. shell 删除文件下的* (copy).jpg备份文件
  6. sublime text3侧边栏主题不生效问题解决
  7. python获取外网地址
  8. Idea1.5使用Maven搭建Apache Spark1.6源码阅读环境
  9. bzoj3052
  10. 【.net 深呼吸】项目中是否有必要删去多余的引用
  11. Django1.10 release notes摘编
  12. Linux常见命令(一)
  13. FTP服务器匿名登录
  14. requests库的基本使用
  15. 20165306 Exp3 免杀原理与实践
  16. JDK的动态代理-----为接口进行代理
  17. 本地上传项目到github
  18. Linux系统下升级Python版本步骤(suse系统)
  19. Spring Batch 批量处理策略
  20. java多线程——监视锁(monitor)(转)

热门文章

  1. SurfaceView的经典写法
  2. Struts Spring Plugin注意点
  3. Smooks转换设计
  4. .net服务器端发起请求封装
  5. ORCAD常见DRC错误
  6. SpringCloud系列七:使用Ribbon实现客户端侧负载均衡
  7. dos指令 批处理文件
  8. Windows Mobile 6开发环境搭建
  9. mysql官网下载页面
  10. IOS MagicRecord 详解 (转载)