我要完成的图片:
这是我正在使用的HTML片段:
<section class="card button ">
<span class="arrow">More Work</span>
</section>
这是我的CSS。我在网上看了一些东西,并尝试在jsbin上玩,但我需要的东西看起来更像一个按钮。
.button span{
background-color: gold;
width: 40%;
height: 30%;
}
.button span::after{
content: "";
position: absolute;
left: 0;
bottom: 0;
width: 0;
height: 0;
border-left: 20px solid black;
border-top: 20px solid black;
border-bottom: 20px solid black;
}
.button span::before{
content: "";
position: absolute;
right: -20px;
bottom: 0;
width: 0;
height: 0;
border-left: 20px solid black;
border-top: 20px solid black;
border-bottom: 20px solid black;
}
答案 0 :(得分:0)
您可以使用没有CSS伪元素的跨度来创建它 检查此代码
<span class="arrow left"></span>
<span class="arrow right"></span>
<span class="arrow up"></span>
<span class="arrow down"></span>
.arrow {
border: solid black;
border-width: 0 3px 3px 0;
display: inline-block;
padding: 3px;
}
.right {
transform: rotate(-45deg);
-webkit-transform: rotate(-45deg);
}
.left {
transform: rotate(135deg);
-webkit-transform: rotate(135deg);
}
.up {
transform: rotate(-135deg);
-webkit-transform: rotate(-135deg);
}
.down {
transform: rotate(45deg);
-webkit-transform: rotate(45deg);
}
答案 1 :(得分:0)
选中此
.btn {
display: inline-block;
margin-bottom: 0;
font-weight: 400;
text-align: center;
vertical-align: middle;
cursor: pointer;
background-image: none;
border: 1px solid transparent;
white-space: nowrap;
padding: 6px 12px;
font-size: 14px;
line-height: 1.42857143;
border-radius: 4px;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.btn-arrow-right {
position: relative;
padding-left: 18px;
padding-right: 18px;
background: red;
}
.btn-arrow-right {
padding-left: 36px;
}
.btn-arrow-right:before,
.btn-arrow-right:after{
content:"";
position: absolute;
top: 4px;
width: 22px;
height: 22px;
background: inherit;
border: inherit;
border-left-color: transparent;
border-bottom-color: transparent;
border-radius: 0px 4px 0px 0px;
-webkit-border-radius: 0px 4px 0px 0px;
-moz-border-radius: 0px 4px 0px 0px;
}
.btn-arrow-right:before,
.btn-arrow-right:after {
transform: rotate(45deg);
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-o-transform: rotate(45deg);
-ms-transform: rotate(45deg);
}
.btn-arrow-right:before
{
left: -11px;
}
.btn-arrow-right:after {
right: -11px;
}
.btn-arrow-right:after {
z-index: 1;
}
.btn-arrow-right:before {
background-color: white;
}
<button type="button" class="btn btn-danger btn-arrow-right">More Work</button>