I am trying to do a header
on my page in which I want to show an image. To do the header
I use a div
:
<div id = "header">
</div>
And I want that an image will be on the background of that div
so I put on the CSS
:
#header{
background-image: url('img/cars.jpg');
background-repeat: no-repeat;
background-attachment: fixed;
background-size: 100%;
top: 0px;
height: 150px;
}
But it is shown like if the image had been cut. I tried replacing background-size: 100%;
to background-size: cover;
but the efect it is the same.
I also tried adding these lines:
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
but the result are the same.
If I try to get it with background-size: contain
the image is being reduced from the right.
What can I do to see the full image on my div?
P.S: I have seen this question css - how to stretch and auto-resize background image but the answers provided did not change anything in my case.
EDIT: Here you can see the effect.
Thanks in advance!