I have and image element wrapped with a div:
<div id="main_image_wrapper">
<img id="main_image" src="image.jpg" />
</div>
And, It is fine until there is no image to show. When the image.jpg
does not exist, I still want to preserve the layout (I will use that later in javascript), So the code will be:
<div id="main_image_wrapper">
<img id="main_image" />
</div>
I expect this div element does not occupy (vertical) space, But unfortunately, it does. I tried to play with line-height
:
div#main_image_wrapper{line-height:1px;}
or
div#main_image_wrapper{line-height:0;}
But the resultant div
height will not be less than 6px
.
When I use:
img#main_image{display:block;}
this extra space will vanish. But I can not use block image in the page layout.
How can I remove this unwanted 6 px
space when the img
is empty?
Thank You Very Much.