I have an interesting problem for you. It might be simple but I’m all out of ideas!
It only appears when I narrow the window to less than 300px that I set as minimum width size. I don’t want any white space below the picture.
The html is;
”’
<!DOCTYPE html>
<link rel="stylesheet" href="index.css">
<html>
<body>
<img src="bakgrunn.jpg" class="bakgrunn" alt="Fantasy Gambling">
</body>
</html>
”’
and the css is;
”’
* {
margin: 0;
padding: 0;
}
.bakgrunn {
width: 100%;
min-width: 300px;
}
”’
Can anyone come up with a solutions to this seemingly simple problem? Thanks so much in advance.
Chris
2
Answers
If you don’t want the area below the image to be white, then set a background color on the body.
If however, you want the image to be as tall as the page, then you need to specify a height for it.
See EDIT comments in the code snippet for specific edits.
The problem is not with the width nor with the height.
The blank space occurs because you haven’t said anything to the browser that covers the whole screen of the phone dimensions or less than 300px.
You can write height: 100vh; in the CSS file to cover the whole screen, as 100vh means 100% of the screen.
Here is an example for you: