I want to set vertical alignment of image inside a div. I use img { vertical-align:middle} but it is not working.
See Question&Answers more detail:osI want to set vertical alignment of image inside a div. I use img { vertical-align:middle} but it is not working.
See Question&Answers more detail:osUsing the line-height
property will solve the problem:
<style>
.someclass {
width: 300px;
height: 300px;
text-align: center;
line-height: 300px;
border: dotted;
}
.someclass img {
margin: auto;
vertical-align: middle;
}
</style>
<div class="someclass">
<img src="someimg.jpg" border="0" alt="">
</div>