An img with height: 100% applies a scroll bar to the web browser.
If there is no <!DOCTYPE> tag, there is no scroll bar.
When you insert the <!DOCTYPE> tag, a scroll bar is created.
I tried several things, but I think <!DOCTYPE> is a problem
I would like to make the scroll bar disappear without using overflow.
<html>
<head>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html, body {
width: 100%;
height: 100%;
}
img {
width: 100%;
height: 100%;
}
</style>
</head>
<body>
<img src="test.jpg">
</body>
</html>
The above source code has no scroll bars, but inserting <!doctype html> creates a scroll bar.
I have used the developer tools to make sure the html, body, and img heights are the same.
I want to know why <!doctype html> causes scroll bars.
And I want to know how to fix it without using overflow in CSS.
