Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

107
Visualizações
CSS gradients and -webkit-background-clip not allowing a transition

.nav-content a {
    color: #000;
    text-decoration: none;
    font-size: 1.1em;
    padding: 20px 40px 20px 40px;
    background-image: linear-gradient(90deg, #000, #000);
    -webkit-background-clip: text;
    font-family: 'Raleway', sans-serif;
    transition: .4s ease-in-out;
}
.nav-content a:hover {
    background-image: linear-gradient(90deg, #6E1D16, #E4DA1E, #D5347D, #15DAE7,#6E1D16, #E4DA1E, #D5347D, #15DAE7);
    -webkit-background-clip: text;
    color: rgba(0,0,0,.1);
    cursor: pointer;
}
<nav class="nav-content">

  <a>Home</a>
  <a>Contact</a>
  <a>About</a>
  
</nav>

So I am trying to get my "navbar" to do a transition-out, but it will only transition-in. I know that gradient transitions are not supported, but does anyone know how to do this? I am fine with a work around too.

about 4 years ago · Santiago Gelvez
2 Respostas
Responde à pergunta

0

The colors are only visible because they only exist while hovering. Just move your linear-gradient background to .nav-content a.

Also, always specify what property to animate (color) to avoid performance issues.

.nav-content a {
    color: #000;
    text-decoration: none;
    font-size: 1.1em;
    padding: 20px 40px 20px 40px;
    -webkit-background-clip: text;
    font-family: 'Raleway', sans-serif;
    transition: color .4s ease-in-out;

    background-image: linear-gradient(90deg, #6E1D16, #E4DA1E, #D5347D, #15DAE7,#6E1D16, #E4DA1E, #D5347D, #15DAE7);
}
.nav-content a:hover {
    -webkit-background-clip: text;
    color: rgba(0,0,0,.1);
    cursor: pointer;
}
<nav class="nav-content">

  <a>Home</a>
  <a>Contact</a>
  <a>About</a>
  
</nav>

about 4 years ago · Santiago Gelvez Relatório

0

I know of this little hack to animate gradients, you can make them twice the size using background-size: 200% and set background-position: left top and transition to background-position: right bottom

.nav-content a {
  background-image: linear-gradient(
    90deg,
    black 50%, /* ADDED THIS */
    #6E1D16,
    #E4DA1E,
    #D5347D,
    #15DAE7,
    #6E1D16,
    #E4DA1E,
    #D5347D,
    #15DAE7
  );
  background-size: 200%;
  background-repeat: no-repeat;
  background-position: left top;

  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;

  color: #000;
  cursor: pointer;
  font: 1.1em 'Raleway', sans-serif;
  padding: 20px 40px 20px 40px;
  text-decoration: none;
  transition: background-position 1s cubic-bezier(0.645, 0.045, 0.355, 1.000);
}

.nav-content a:hover { background-position: right bottom }
<nav class="nav-content">
  <a>Home</a>
  <a>Contact</a>
  <a>About</a>
</nav>

about 4 years ago · Santiago Gelvez Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda