[Vuejs]-To add background-image with vuejs and looks good

0👍

You should try background-size: contain. You should also set the width of the element to 100vw instead of 100%. That way the div will be the width of the screen.

So your code should look like this:

.home-hero {
    background: url("https://i.postimg.cc/0NbqSxfQ/banner-image.png");
    background-size: contain; /* This changed */
    width: 100vw; /* This changed */
    height: 100vh;
}

Leave a comment