CSS学习15:圆角边框

border-radius 属性用于设置元素的外边框圆角。

语法:

border-radius:length;   

参数可百分比,也可是具体px值。

圆角边框也可分开写:

border-radius: 0px 0px 30px 0px; 顺序左上 右上 右下 左下       推荐

以下不推荐

border-top-left-radius                左上角

border-top-right-radius              右上角

border-bottom-right-radius        右下角

border-bottom-left-radius           左下角

代码: 

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div {
            width: 400px;
            height: 200px;
            background-color: #ccc;
            /* 1.跟具体的px值,实际使用中自己测试感觉那个合适 */
            /* border-radius: 30px; */
            /* 2. 跟百分比 跟百分比时最常见的值就是50% */
            border-radius: 50%;
        }
        p {
            width: 100px;
            height: 40px;
            background-color: red;
            /* 用高度的一般当作圆角 */
            border-radius: 20px;
        }
        h1 {
            width: 200px;
            height: 200px;
            background-color: skyblue;
            /* border-radius: 10px 20px 30px 40px; */
            border-radius: 0px 0px 30px 0px;
        }
    </style>
</head>
<body>
    <div></div>
    <p></p>
    <h1></h1>
</body>
</html>

页面显示: 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值