简体   繁体   中英

background image does not want to strech to full width within the section container

as you can see in my code example and the screenshot the image won't fit the container even with 100% width or whatever property I try to use. Below you can find my code

.about-us{

    background-image: url(images/about-us-background.png);
    width: 100%;
    height: 100vh;
    background-repeat: no-repeat;
}

Even though I have got another section with the same code and it definitely works with the same piece of code. Here I don't see any issue but still, it is not working. web page screenshot

Try to change the width part as it was 100% its stretch up to container width

Example width: 3vw; (Change according to u)

you should also add background-size:cover;

you can add background-cover: cover or 100% 100% or object-fit: cover in your css

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM