Can someone help me figure out why my logo image isn’t resizing according the the browser size?
—————-CSS———————
body {
height: 100%;
background-color:#333;
}
#logo {
max-width: 100%;
}
img {
border: 0;
max-width: 100%;
height: auto;
}
#header-bg {
background-image: url("header-bg.png");
overflow: auto;
width: 100%;
}
—————-HTML——————-
<body>
<div id="header-bg">
<div id="logo">
<img src="logo.png" />
</div>
</div>
</body>
The reason is, you have given
max-width, which might be less than the originalwidth. So givingwidthwill solve your issue.Other than this, everything is right.
If you feel that your image is not soooo big, that it occupies the whole width of the screen, give a smaller width to the parent, say
25%. And to the image awidthof100%. So the parent adjusts for sure according to the width of the screen, so is your image.:)