一.边框的形状
设置边框的四个边不同颜色,同时加粗边框
div{
width: 300px;
height: 300px;
border:50px solid red;
border-color: black blue green pink;
}```
![梯形边框](http:https://img.haomeiwen.com/i1722340/9653003a924a7ef4.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
**此时边框是梯形的!**
减小容器div的宽和高,直至为0
div{
width: 0px;
height: 0px;
border:50px solid red;
border-color: black blue green pink;
}```
![](https://img.haomeiwen.com/i1722340/02c2e728513f6196.png)
此时边框成为三角形!
二.利用边框特性画三角形
只需要让其他三个角的颜色和背景色相同,留下一个三角即可
div{
width: 0px;
height: 0px;
border:50px solid red;
border-color: white white red white;
}
![](https://img.haomeiwen.com/i1722340/d57cfa0ca0c87f48.png)
三.利用边框特性画圆
border-radious 给div元素添加圆角的边框
div{
width: 100px;
height: 100px;
border:1px solid red;
border-radius: 10px;
}
![](https://img.haomeiwen.com/i1722340/91f21cd9780c1acb.png)
当border-radius的值大于等于width和heigh(width=height)值的一半时,就成为一个圆
![](https://img.haomeiwen.com/i1722340/15097af44f38789b.png)
网友评论