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

121
Visualizações
inline css style doesn't show up when using a variable array to assign styles

im trying to make a slider using react slick, and each slide inside the react slick slider is a card with a different background (a linear-gradient). i've been trying to give each card a different background but it's not working (nothing shows up, when i inspect element its as if i never even applied this style??)

so heres my array of linear gradients (js)

const gradients = [
    "linear-gradient(135deg, #D8D6FF 0%, #FEF0F9 100%)",
    "linear-gradient(135deg, #FEF0F9 0%, #CEE7FD 100%)",
    "linear-gradient(135deg, #CEE7FD 0%, #DCF7F5 100%)",
    "linear-gradient(135deg, #DCF7F5 0%, #EBF8DE 100%)",
    "linear-gradient(135deg, #EBF8DE 0%, #FFEBD8 100%)",
    "linear-gradient(135deg, #EBF8DE 0%, #FFEBD8 0.01%, #F7D8E7 100%)"
];

this is my react slick slider, i tried to use the index to match up with the gradients array so each card has its respective linear gradient (js)

<Slider {...settings} className={styles.slider}>
      {miniProjects.map((project, i) => (
           <div className={styles.card} style={{background: gradients[i]}}>
               {project.name}
           </div>
       ))}
</Slider>

and just for the sake of it, heres my styling for slider and card (css)

.slider {
    width: auto;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content:space-between;
    margin-left: 175px;
}

.card {
    width: 400px !important;
    height: 400px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

i dont know if this is some kind of react slick issue, or my syntax is wrong in the javascript file which is why the linear gradients are being ignored.

about 4 years ago · Juan Pablo Isaza
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