0

everyone please advise, I have an array with images, and I've created a mapping content, however I can not put a Background Image, in styles of a component. Other array objects is properly working

{DlCards.map((mdlcard) => {
    return(
    <Grid
        item
        xs = {mdlcard.grid_xs} 
        sm = {mdlcard.grid_sm} 
        md = {mdlcard.grid_md}
        container
        justify = 'space-between'
        style   = {{
            width:      '25%', 
            marginTop:  60,
            backgroundImage: {mdlcard.background}
            
        }}>
1
  • background-image in CSS uses the syntax background-image: url(<url>), you need to replicate that with your style there, aka backgroundImage: url(${mdlcard.background})` Commented Jul 21, 2020 at 5:16

1 Answer 1

1
style   = {{
            width:      '25%', 
            marginTop:  60,
            backgroundImage: {`url(${mdlcard.background})}
            
        }}>

you missed the url

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you, very much
you are welcome. Can i get a up vote and right answer mark

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.