I want to vertical align an IMG in a DIV but I don't see what I'm doing wrong. It works in FF and IE7, but other browsers just align it to the top. Code can be found here:
Asked
Active
Viewed 9,448 times
2
-
Check this link i use it and its usefull for you [vertical align image in div][1] [1]: http://stackoverflow.com/questions/7336503/how-to-vertical-align-image-inside-div/11716065#11716065 – Bip May 22 '13 at 08:17
1 Answers
1
<style type="text/css">
.wraptocenter {
display: table-cell;
text-align: center;
vertical-align: middle;
width: ...;
height: ...;
}
.wraptocenter * {
vertical-align: middle;
}
</style>
<!--[if lt IE 8]>
<style>.wraptocenter span { display: inline-block; height: 100%;}/style>
<![endif]-->
<div class="wraptocenter"><span></span><img src="..." alt="..."></div>
Check this out link out, it has certainly helped me out:

Ted
- 3,985
- 1
- 20
- 33
-
2link only answers are bad practice, you should add some description to it. – Samy S.Rathore Mar 12 '14 at 06:11