-5
When using the property background-size: 100%
you are setting that the width of the background image will occupy the entire width of the body. This is because the property background-size
may have two values:
background-size: largura altura
↑ ↑
1º valor 2º valor
In his case, only the width was set at 100% (1st value). Thus, if the height of the window is greater than the height of the image, the image will not take up the entire vertical space.
You could use a second value (height) at 100%, but that would break the image ratio (Aspect ratio): background-size: 100% 100%;
What you have to do is use the value cover
:
background-size: cover;
The cover
will cover the entire body area to full height, but you can cut a right side of the background image because it will increase the image to the height of the window, keeping the image aspect.
So, if you like, you can use another property to keep the image centered, because, if there is a cut on the sides, they are the same on the left and right side, and not just on the right side:
background-position: center;
Soon your style will be:
body {
background-image: url(IMGS/img08.jpg);
background-repeat: no-repeat;
background-size: cover;
background-position: center;
background-attachment: fixed;
}
My dear friend, please quickly edit the question, for example, put the HTML structure that references that banner you want to set up. Okay? I already make a quick code to help you ^^
– Lougans de Matos
Hey, I know you’re new but don’t insert an image as a direct background into the body. Create a tag first
header
or adiv
normal because then you can set the size you want. Then inside these tags Voce puts the background-image, ok?– Lougans de Matos