Mic*_*cko 3 html css css3 css-shapes
我需要的是用两个右箭头实现按钮.用于切割按钮左侧的一个箭头和用于延伸按钮右侧的一个箭头(请参见附图).
我现在成功的只是添加右箭头(见下图).
以下是我当前的CSS.
.arrow-button {
width: 178px;
height: 82px;
position: relative;
object-fit: contain;
margin-right: 20px;
background-color: #be1a20;
}
.arrow-button:before {
content:"";
position: absolute;
left: 100%;
top: 26px;
width: 0;
height: 0;
border-top: 13px solid transparent;
border-left: 13px solid #be1a20;
border-bottom: 13px solid transparent;
}
.arrow-label {
font-family: Montserrat;
font-size: 13px;
font-weight: 500;
font-style: normal;
font-stretch: normal;
line-height: normal;
letter-spacing: normal;
text-align: center;
color: #ffffff;
margin: auto;
}
.layer {
font-family: Montserrat;
font-size: 24px;
font-weight: bold;
font-style: normal;
font-stretch: normal;
line-height: normal;
letter-spacing: normal;
text-align: center;
color: #ffffff;
margin: auto;
}Run Code Online (Sandbox Code Playgroud)
<div class="arrow-button">
<div class="row">
<label class="arrow-label">
SENT
</label>
</div>
<div class="row">
<label class="layer">
10
</label>
</div>
</div>Run Code Online (Sandbox Code Playgroud)
与右箭头相似,使用:before和:after:
.arrow-button {
width: 178px;
height: 82px;
position: relative;
object-fit: contain;
margin-right: 20px;
background-color: #be1a20;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
}
.arrow-button:before,
.arrow-button:after {
content: "";
position: absolute;
left: 0;
top: 26px;
width: 0;
height: 0;
border-top: 13px solid transparent;
border-left: 13px solid white;
border-bottom: 13px solid transparent;
}
.arrow-button:after {
left: 100%;
border-left: 13px solid #be1a20;
}
.arrow-label {
font-family: Montserrat;
font-size: 13px;
font-weight: 500;
font-style: normal;
font-stretch: normal;
line-height: normal;
letter-spacing: normal;
text-align: center;
color: #ffffff;
margin: auto;
}
.layer {
font-family: Montserrat;
font-size: 24px;
font-weight: bold;
font-style: normal;
font-stretch: normal;
line-height: normal;
letter-spacing: normal;
text-align: center;
color: #ffffff;
margin: auto;
}Run Code Online (Sandbox Code Playgroud)
<div class="arrow-button">
<div class="row">
<label class="arrow-label">SENT</label>
</div>
<div class="row">
<label class="layer">10</label>
</div>
</div>Run Code Online (Sandbox Code Playgroud)
所以,唯一的区别从左边右箭头是left和border-left你需要重新定义样式:
.arrow-button:after {
left: 100%;
border-left: 13px solid #be1a20;
}
Run Code Online (Sandbox Code Playgroud)
请注意,我使用flexbox进行垂直对齐文本,但您不必这样做,这与箭头无关.
| 归档时间: |
|
| 查看次数: |
74 次 |
| 最近记录: |