I have 3 images vertically aligned in fixed height div. How can I make sure that the top and bottom padding between them remains even when an image is added or deleted.
Say the Div height is 100px and the image height is 20px. So 3 images with 20px would sum up to 60px. The remaining 40px should evenly get distributed as padding between the images.
Similarly when another image is added, the remaining 20px should be total padding between all images.
The property : vertical-align: middle is not working here.
You want to:
display:tablewith a fixed height,<img>in element withdisplay:table-rowanddisplay:table-celldisplay:blockvertical-align:middleThis will cause the space to be evenly distributed vertically.
Demo: http://jsfiddle.net/X2URZ/2/
Code: