I am encountering an issue with the height of the div.divB
element in this code snippet:
<div class="divA">
<img src="http://lorempixel.com/1000/130"/>
<div class="divB">
<span>Text text</span>
</div>
</div>
You can view the code on this jsfiddle link.
Why is the height of div.divB
not equal to the height of div.divA
even though its height is set to 100%? I need to ensure that "text text" appears centered vertically.
EDIT:
The image height is random as it is uploaded by the user. In this example, I have used a height of 130, but it could be any other value like 200 or 50.