I need to make a button with border and text color gradient, but the button also has border-radius. I have tried several ways here, but I have not been successful. What is the best way to do this button?
The button is this:
WhatIhavesofar:
link
This comes close to what you need:
.botao {
display: inline-block;
padding: 12px 18px;
border-radius: 10px;
text-decoration: none;
font-family: Sans-serif;
font-weight: bold;
overflow: hidden;
position: relative;
margin: 10px;
z-index: 0;
}
.botao span {
text-transform: uppercase;
font-size: 16px;
position: relative;
z-index: 0;
background: linear-gradient(to right, #4382c9, #5bafe4);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
color: transparent;
}
.botao:before {
content: '';
background: linear-gradient(to right, #4382c9, #5bafe4);
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: -2;
}
.botao:after {
content: '';
background: #fff;
top: 2px;
bottom: 2px;
left: 2px;
right: 2px;
position: absolute;
border-radius: 8px;
z-index: -1;
}
<a href="" class="botao"><span>Conheça</span></a>
Well, first of all, putting gradient in borders is a bit tricky,
EDIT:
I made this small example of a button the result is almost identical:
a {
text-decoration: none;
font-family:sans-serif;
}
input{
background:none;
border: none;
}
.outer {
padding: 2px;
text-align: center;
border-radius: 8px;
background: linear-gradient(to right, #04a6f3, #0072ff);
width: 150px;
}
.inner {
display: block;
border-radius: 6px;
font-size: 18px;
font-weight: 700;
width: 100%;
background-color: #fff;
color: #0095ff;
height: 100%;
padding-top: 10px;
padding-bottom: 10px;
}
<div class="outer">
<a href="#" class="inner">CONHEÇA</a>
</div>
.MeuBotao {
padding: 10px;
border-radius: 4px;
font-weight: 600;
background-image: linear-gradient(to bottom, white, purple);
}
.MeuBotao h3 {
font-size: 40px;
background: -webkit-linear-gradient(#eee, #333);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
<button class="MeuBotao" type="button"><h3>Conheça</h3></button>
Study sources:
Ready buddy! Here it is! Now it's just for your style! I hope I have helped