Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

112
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!