Home > other >  My react app has tiny space at the corner
My react app has tiny space at the corner

Time:05-27

I've added an image for my background, but there is tiny space at the corner (Please see the pic I attached).

I applied the below code for this.
My other website doesn't show like this. How can I remove this tiny white space?

function Home() {

    return(
        <div //className='home-background'
        style={{
            backgroundImage: `url(${background})`,
            backgroundRepeat: 'no-repeat',
            backgroundSize: 'cover',
            height: '100vh',
            width: '100vw',
            // backgroundPosition: 'center',
        }}
        >
            <div>Home</div>
        </div>
    )
}

export default Home;

enter image description here

CodePudding user response:

Try this.

html, body {
  margin: 0px;
  padding: 0px;
}

CodePudding user response:

I recommend setting in the CSS file for styling all elements.

*{
  margin: 0;
  padding: 0;
  box-sizing: border-box;
 }
  • Related