I am developing a webpage in which I am setting background with help of div but my problem is that when the resolution of screen changes the image does not fit properly , it shows blank space on both side of screens on large screens. Is there a way with which I can make a standard case which shall run for all screens .
This is how I am setting my div
mheaderimgs {
width:1007px;
margin:auto auto;
height:auto;
}
CSS backckground-size property,
background-size:contain;
for more reference, see
width:100% would strech it, If you make it a slightly bigger image it would shrink it in most cases only making you need 1 image.
As far as Im aware, there is no none-javascript method to get the size of the screen and then compare to set sizes
Php doesn't know how big the clients screen is. Consider javascript or Media queries .
May be you can try this (CSS3 property) :
background-size: cover;
Otherwise, I think you can do it in javascript.