.box:after {
content: '';
position: absolute;
top: -1px;
right: -5px;
width: 0;
height: 0;
border-bottom: 23px solid #ff0e1f;
border-right: 5px solid transparent;
}
.box:before {
content: '';
position: absolute;
top: 0;
left: -5px;
width: 0;
height: 0;
border-top: 23px solid #ff0e1f;
border-left: 5px solid transparent;
}
.box {
margin-left: 20px;
position: relative;
background-image: linear-gradient(135deg,rgb(131,0,255) 14%,rgb(234,48,255) 100%);
padding: 3px 13px;
line-height: 16px;
display: inline-block;
}
.box>a {
color: #fff!important;
background-image: linear-gradient(135deg,rgb(131,0,255) 14%,rgb(234,48,255) 100%);
text-transform: uppercase;
font-size: 13px;
text-decoration: none;
font-family: poppins;
font-weight: bold;
}
<div class="box">
<a href="https://www.youtube.com/">Esports is the best game</a></div>
I want to add gradient to the whole part which is showing in red color. But I am not finding any way to do this. Is there anyone who can fix this?I have tried a lot of different codes but nothing is working for me.
If I add gradient color to the red part then transparent border will not work. Can I fix this? Or is there any other code instead of div through which I can do the thing which I want.
Here is my sample code:
<div class="box">
<a href="https://www.youtube.com/">Esports is the best game</a></div>
.box:after {
content: '';
position: absolute;
top: -1px;
right: -5px;
width: 0;
height: 0;
border-bottom: 23px solid #ff0e1f;
border-right: 5px solid transparent;
}
.box:before {
content: '';
position: absolute;
top: 0;
left: -5px;
width: 0;
height: 0;
border-top: 23px solid #ff0e1f;
border-left: 5px solid transparent;
}
.box {
margin-left: 20px;
position: relative;
background-image: linear-gradient(135deg,rgb(131,0,255) 14%,rgb(234,48,255) 100%);
padding: 3px 13px;
line-height: 16px;
display: inline-block;
}
.box>a {
color: #fff!important;
background-image: linear-gradient(135deg,rgb(131,0,255) 14%,rgb(234,48,255) 100%);
text-transform: uppercase;
font-size: 13px;
text-decoration: none;
font-family: poppins;
font-weight: bold;
}
Here is the correct HTML and CSS code:
.box {
background-image: linear-gradient(135deg, rgb(131, 0, 255) 14%, rgb(234, 48, 255) 100%);
clip-path: polygon(calc(0% + 12px) 0%, 100% 0%, calc(100% - 12px) 100%, 0% 100%);
padding: 3px 13px;
display: inline-block;
}
.a {
color: #fff!important;
text-transform: uppercase;
font-size: 13px;
text-decoration: none;
font-family: poppins;
font-weight: bold;
}
<div class="box">
<a href="https://www.youtube.com/" class="a">Tournaments</a>
</div>