CSS3是否可以创建一个同时具有圆角和虚线的边框?
我正在创建圆角边框,但它们看起来很实心,代码如下:
border: 1px dotted gray;
-moz-border-radius-topright: 30px 20px;
-moz-border-radius-topleft: 30px 20px;
边框的其余部分为点状,但角落是实心的。
我知道这是特定于Firefox的,但现在没关系。
谢谢
CSS3是否可以创建一个同时具有圆角和虚线的边框?
我正在创建圆角边框,但它们看起来很实心,代码如下:
border: 1px dotted gray;
-moz-border-radius-topright: 30px 20px;
-moz-border-radius-topleft: 30px 20px;
边框的其余部分为点状,但角落是实心的。
我知道这是特定于Firefox的,但现在没关系。
谢谢
这是Firefox的一个漏洞。请查看该问题,Mozilla不支持在虚线和点线边框中使用圆角。
我无意中找到了一个解决方案。
以下是代码:
background-color: none !important;
border:none !important;
border-top: 5px dotted #70c1bb !important;
border-top-width:5px;
border-right-width:0px;
border-bottom-width:0px;
border-left-width:0px;
是的,理论上你可以有点状和圆角边框,但实际上你可能会发现浏览器还不支持它。
hr{
border: 4px;
border-style:dotted none none none;
/* border-style:none;
border-top-style: dotted; */
width:100px;
}
<hr>
一种解决方案是使用多个背景图像。您可以使用此方法为四个角指定不同的background-image
。
您可能还想添加第五个图像作为中心背景图像(如果需要,可以重复)。
大致如下...
.dashed-rounded-border {
border: 2px dashed blue;
background-image: url("top-left.png"), url("top-right.png"), url("bottom-right.png"), url("bottom-left.png"), url("center.png");
background-position: left top, right top, right bottom, left bottom, center center;
background-repeat: no-repeat, no-repeat, no-repeat, no-repeat, repeat-x;
-webkit-border-radius: 22px;
-moz-border-radius: 22px;
border-radius: 22px;
}
引用:使用这个会起作用
border-style: none;
border-top-style: dotted;
border-width: thick;