freddiefujiwara
freddiefujiwara

Reputation: 59069

How to set img tag vertical center : html + css

I'm coding it

<div>
 <a href="http://example1.com">
   <img src="example1.gif" />
 </a>
</div>
<div>
 <a href="http://example2.com">
   <img src="example2.gif" />
 </a>
</div>

a {
  text-align:center;
  height :80px;
  display:block;
}

The centering of the horizontal direction do well. but vertical is not. How to do it? By the way, the height of example2.gif is different from example1.gif

Upvotes: 0

Views: 7166

Answers (1)

Andr&#233; Eriksson
Andr&#233; Eriksson

Reputation: 4360

You will want to set vertical-align: middle; on your img elements.

Upvotes: 1

Related Questions