css3系列之详解border-radius

本文详细介绍了CSS中border-radius属性的不同写法及其应用效果,包括如何使用百分比和像素值来创建圆形和椭圆形的边角。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

border-radius

border-radius 几种写法:

  1.border-radius: 50%; 

  以正方形为例子, 这样写就是设置 4个角 为50%。

 

  2.border-radius: 50% 50%;

       这样是设置, 左上角 和 右下角 为50%。   右上角 和 左下角为50%

 

  3.border-radius: 10px 20px 30px 40px /  10px 20px 30px 40px;

   这四个值代表的位置是   左上  右上  右下 左下 / 左上  右上  右下 左下

 

  4.border-radius-top-left: 10px;  ==  border-radius-top-left: 10px 10px;   左上 

     border-radius-top-right: 10px;  ==  border-radius-top-right: 10px 10px;  右上

     border-radius-bottom-right: 10px;  ==  border-radius-bottom-right: 10px 10px;  右下

     border-radius-bottom-left: 10px;  ==  border-radius-bottom-left: 10px  10px;  左下

这些值,为什么这么设置的,请看下面讲解:

 

接下来来看看,圆是怎么实现的。(哈哈哈,灵魂画手)

所以说,需要8个值来设置, 只是平常我们把它缩写了。

border-radius-top-left: 10px 10px;   第一个参数为 水平线,第二个参数为垂直线 ;

利用所学到的,画个椭圆吧。正方形肯定不能画椭圆,要用长方形

 

转载于:https://www.cnblogs.com/yanggeng/p/11191518.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值