Hello! I am trying to create a homepage. But the problem is, my image is too big, so the scrollbars appear. Image resolution is 1920x1280 and mine screen is 1366x768. I want to make a responsive background image.
Here is the part of the code in html:
<img src="city.jpg">
</body>
and here is the css code:
body img {
background-image: url(city.jpg);
background-position: center center;
background-repeat: no-repeat;
background-attachment: fixed;
background-size: cover;
background-color: #464646;
}
How to make my image responsive (so that it automatically scales to the screen size)?
There is a section with relative units! Like, vh, vw, ect.
(vh stands for viewport height, vw - viewport width.)
Anyway, there are a lot of ways to make a div/image 100%, 50% of the screen or any other size you want