div边框弧形设计,css3的border-radius属性

400 阅读1分钟

border-radius属性

向 div 元素添加圆角边框:

 <div></div>
   <style>
        div {
            background-color: #15dfdf;
            width: 350px;
            height: 350px;
            border-radius: 36px 36px 36px 36px;
        }
    </style>

在这里插入图片描述

弧度可根据实际情况进行调整

也可上下左右分开表示:

例:border-radius:5px; 等价于: border-top-left-radius:5px; //左上角 border-top-right-radius:5px; //右上角 border-bottom-right-radius:5px; //右下角 border-bottom-left-radius:5px; //左下角

不仅用像素可以表示,也可以使用百分比:

length 定义圆角的形状。 % 以百分比定义圆角的形状。

例:border-radius:10%;