当前位置: 首页 > Web前端 > CSS

CSS实现圆角反方向原理

时间:2023-03-31 12:17:25 CSS

父元素是相对的,子元素是绝对的,然后通过top,left,right,bottom设置具体的出现位置。DOM结构

CSSstyle.wrapper-dashed{position:relative;高度:1px;width:100%;}/*虚线实现*/.dashed{border-top:1pxdashed#cccccc;高度:1px;溢出:隐藏;}.dashed:之前,.dashed:之后{显示:块;位置:绝对;内容:””;宽度:10px;高度:10px;背景颜色:#f3f5f9;边界半径:50%;top:-5px;}.dashed:before{left:-5px;}.dashed:after{right:-5px;}效果图