<div class="button">リンクボタン</div>
「button」というclassで作成していきます。
目次
.button {
position: relative;
background: #333;
width: 200px;
padding: 0.6rem 1.2rem;
text-align: center;
color: #fff;
border-radius: 6px;
}
.button::after {
content: "";
position: absolute;
top: 50%;
right: 2%;
transform: translateY(-50%);
border: 8px solid transparent;
border-left: 12px solid #fff;
}
.button {
position: relative;
background: #333;
width: 200px;
padding: 0.6rem 1.2rem;
text-align: center;
color: #fff;
border-radius: 6px;
}
.button::after {
content: "";
position: absolute;
top: 35%;
right: 4%;
border: 8px solid transparent;
border-top: 12px solid #fff;
}
.button {
position: relative;
color: #333;
padding:0 0 0 1.4rem;
}
.button::before,.button::after{
content: "";
position: absolute;
top: 0;
bottom: 0;
left: 0;
margin: auto;
}
.button:before{
width: 18px;
height: 18px;
border-radius: 50%;
background: #d40000;
}
.button:after {
left: 6px;
box-sizing: border-box;
width: 12px;
height: 12px;
border: 6px solid transparent;
border-left: 8px solid #fff;
}
.button {
position: relative;
color: #333;
padding:0 0 0 1.4rem;
}
.button::before,.button::after{
content: "";
position: absolute;
top: 0;
bottom: 0;
left: 0;
margin: auto;
}
.button:before{
width: 18px;
height: 18px;
background: #d40000;
border-radius: 5px;
}
.button:after {
left: 6px;
box-sizing: border-box;
width: 12px;
height: 12px;
border: 6px solid transparent;
border-left: 8px solid #fff;
}
.button {
position: relative;
background: #333;
width: 200px;
padding: 0.6rem 1.2rem;
text-align: center;
color: #fff;
border-radius: 6px;
}
.button::after {
content: "";
position: absolute;
width: 8px;
height: 8px;
margin-top: -5px;
border-top: solid 2px #fff;
border-right: solid 2px #fff;
transform: rotate(45deg);
top: 50%;
right: 5%;
}
.button {
position: relative;
background: #333;
width: 200px;
padding: 0.6rem 1.2rem;
text-align: center;
color: #fff;
border-radius: 6px;
}
.button::after {
content: "";
position: absolute;
width: 8px;
height: 8px;
margin-top: -5px;
border-top: solid 2px #fff;
border-right: solid 2px #fff;
transform: rotate(225deg);
top: 50%;
left: 5%;
}
いかがでしょうか。
あとはこれを応用して、位置や角度を変えると幅が広がりますね。