It is not possible in css.
but you can use @media rules to do this
@media screen is used for computer screen and
@media handheld is for small or handheld devices.
like
@media screen
{
width: 100%;
}
and
@media handheld
{
width: 50%;
}
or you can use bootstrap to make image responsive which will adjust image when resizing by downloading bootstrap from www.getbootstrap.com or by the cdn
//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css
and then add class "img-responsive" to img tag. it will adjust the height and width of the image.. if you want fixed heght you must specify the height of the image using another class or style property
<img src="" style="height:100px;">
Another method is to use javascript Browser Object Model
screen.width
and applying conditonal statements. I think it is better to use javascript