使用 css 制作票证按钮
Make ticket button with css
我有设计,客户只想做按钮 CSS
我找到了几种方法,但都不一样。
而且我无法改进到完美的副本。
你可以使用伪元素并从它们的阴影中绘制背景,example:
a {
margin:3em;
font-family:arial;
text-decoration:none;
position:relative;
display:inline-block;
padding:1.5em 5em;
text-transform:uppercase;
overflow:hidden;
color:white;
border:3px solid white;
border-left:none;
border-right:none;
background:linear-gradient(to left, white 3px, transparent 3px, transparent calc(100% - 3px), white calc(100% - 3px)) top left no-repeat,linear-gradient(to left, white 3px, transparent 3px, transparent calc(100% - 3px), white calc(100% - 3px)) bottom left no-repeat;
background-size:100% 1.45em;
}
a:before,a:after {
z-index:-1;
content:'';
position:absolute;
height:1.2em;
width:1em;
top:1.4em;
border-radius:50%;
border:3px solid white;
box-shadow:0 0 0 10em #102229;
}
a:before {
left:-0.7em;
}a:after {
right:-0.7em;
}
b:after {
content:'>';
color:#DA153E;
font-weight:bold;
}
body {
background:url(http://lorempixel.com/600/300);
}
<a href="#"> <b>get a free quote </b></a>
我有设计,客户只想做按钮 CSS
我找到了几种方法,但都不一样。 而且我无法改进到完美的副本。
你可以使用伪元素并从它们的阴影中绘制背景,example:
a {
margin:3em;
font-family:arial;
text-decoration:none;
position:relative;
display:inline-block;
padding:1.5em 5em;
text-transform:uppercase;
overflow:hidden;
color:white;
border:3px solid white;
border-left:none;
border-right:none;
background:linear-gradient(to left, white 3px, transparent 3px, transparent calc(100% - 3px), white calc(100% - 3px)) top left no-repeat,linear-gradient(to left, white 3px, transparent 3px, transparent calc(100% - 3px), white calc(100% - 3px)) bottom left no-repeat;
background-size:100% 1.45em;
}
a:before,a:after {
z-index:-1;
content:'';
position:absolute;
height:1.2em;
width:1em;
top:1.4em;
border-radius:50%;
border:3px solid white;
box-shadow:0 0 0 10em #102229;
}
a:before {
left:-0.7em;
}a:after {
right:-0.7em;
}
b:after {
content:'>';
color:#DA153E;
font-weight:bold;
}
body {
background:url(http://lorempixel.com/600/300);
}
<a href="#"> <b>get a free quote </b></a>