我想創建一個像我附加的箭頭,只使用CSS。使用CSS的箭頭
我發現下面的article,但我不能只刪除一個尖尖的結束。
/* General Button Style */
.button {
box-sizing: border-box;
position: relative;
display: inline-block;
min-width: 200px;
height: 80px;
margin: 40px auto;
color: #fd0;
text-align: center;
text-decoration: none;
line-height: 80px;
}
.button:before,
.button:after {
position: absolute;
content: '';
width: 100%;
left: 0px;
height: 34px;
z-index: -1;
}
.button:before {
transform: perspective(15px) rotateX(3deg);
}
.button:after {
top: 40px;
transform: perspective(15px) rotateX(-3deg);
}
/* Button Border Style */
.button.border:before,
.button.border:after {
border: 4px solid #fd0;
}
.button.border:before {
border-bottom: none;
/* to prevent the border-line showing up in the middle of the shape */
}
.button.border:after {
border-top: none;
/* to prevent the border-line showing up in the middle of the shape */
}
/* Button hover styles */
.button.border:hover:before,
.button.border:hover:after {
background: #fd0;
}
.button.border:hover {
color: #fff;
}
/* Just for demo */
body {
background: radial-gradient(circle, #3F9CBA 0%, #153346 100%);
text-align: center;
}
<!-- Library included to avoid browser prefixes -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
<a href="#" class="button ribbon-outset border">Click me!</a>
<br/>
你嘗試過什麼嗎?如刪除:before規則還是其他? –
@Gyryrillus在這種情況下,只刪除':before'將不起作用 –
@AbhishekPandey我知道,但OP是否嘗試過任何東西。發帖:'我要...' –