Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

React:js: How can i add background Image to a stack or div?

For design, I’m using Chakra UI. I want to put a background image to this div, but I’m not sure how to do it.

 import React from 'react';
    import { Stack, Heading, Image, Button } from '@chakra-ui/react';
    import netflixLogo from '../../assets/images/netflixLogo.png';
    const SignUp = () => {
      return (
        <Stack>
          <div
            style={{
              width: '100%',
              height: '100%',
              backgroundImage: `url('../../assets/images/netflixLogo.png')`,
              backgroundPosition: 'center',
            }}
          >
            <Stack width={'full'} justifyContent={'space-between'} direction={'row'} px={'2.5rem'} >
              <Image height={'80px'} width={'200px'} src={netflixLogo} />
              <Button width={'80px'} >Sign In</Button>
            </Stack>
          </div>
        </Stack>
      );
    };
    
    export default SignUp;

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Try this

backgroundImage: `url(${netflixLogo})`,
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading