Wrap div around image

css

Solution

You could add these:

img {
    display: block;
}

.q {
    float: left;
}

and remove:

.q {
    width: 100%
    height: 100%;
}

jsfiddle

Problem

I have a div around an image like this: ``` <div class="q"> <img src="http://upload.wikimedia.org/wikipedia/commons/a/af/Bonsai_IMG_6426.jpg" /> </div> ``` The result is that the div is bigger than the image. I would like to wrap it around the image giving it the same height and width (without setting dimension) ``` img { z-index: -1; position: relative; width:300px; } .q { width:100%; height:100%; box-shadow:inset 0px 0px 85px red; -webkit-box-shadow:inset 0px 0px 85px red; -moz-box-shadow:inset 0px 0px 85px red; } ``` I tried height and width 'auto' but it also doesn't work. JsFiddle

Original source