【发布时间】:2023-04-03 01:10:02
【问题描述】:
【问题讨论】:
-
我不这么认为。我想你可以只使用一张图片。
-
this 帮了我
标签: css css-transforms
【问题讨论】:
标签: css css-transforms
hand-drawn borders 上的这篇文章给出了一个很好的例子,它通过使用大椭圆圆角(通过 CSS border-radius 属性)仅使用 CSS 实现按钮的这种效果。它可能不适用于大型 div 元素。
示例改编自文章:
button {
background:transparent;
padding:0.5rem 0.5rem;
margin:0 0.5rem;
font-size:1rem;
border-top-left-radius: 255px 15px;
border-top-right-radius: 15px 225px;
border-bottom-right-radius: 225px 15px;
border-bottom-left-radius:15px 255px;
}
button:hover{
box-shadow:2px 8px 4px -6px hsla(0,0%,0%,.3);
}
button.lined.thick{
border:solid 3px #41403E;
}
button.dotted.thick{
border:dotted 3px #41403E;
}
button.dashed.thick{
border:dashed 3px #41403E;
}
button.lined.thin{
border:solid 2px #41403E;
}
button.dotted.thin{
border:dotted 2px #41403E;
}
button.dashed.thin{
border:dashed 2px #41403E;
}
<button class='lined thick'>Lined Thick</button>
<button class='dotted thick'>Dotted Thick</button>
<button class='dashed thick'>Dashed Thick</button>
<div> </div>
<button class='lined thin'>Lined Thin</button>
<button class='dotted thin'>Dotted Thin</button>
<button class='dashed thin'>Dashed Thin</button>
【讨论】:
您可以使用CSS Border Images。
Here is an example 在 w3schools 网站上。
这是一个代码示例:
#borderimg {
/* You can also use border-top or border-bottom to target the side you want affected */
border: 10px solid transparent;
padding: 15px;
-webkit-border-image: url(border.png) 50 round; /* Safari 3.1-5 */
-o-border-image: url(border.png) 50 round; /* Opera 11-12.1 */
border-image: url(border.png) 50 round;
}
【讨论】: