cssreactjsjsxdirectus

How to use DirectusImage tag as a background?


I am a newbie when it comes to using Directus. I am trying to style an card to have a background image of a Directus Image. How would i be able to do that?

I have tried:

<Card style={{backgroundImage:"url({someColletion.image.id})" >
    <CardHead/><CardContent />
</Card>

Solution

  • Style as following:

    <Container style={{position: "absolute">

    <DirectusImage style={{position:"relative"}} />

    Reference: https://www.w3schools.com/howto/howto_css_image_text.asp