Align image vertically to middle in HTML and CSS

Description

The following code shows how to align image vertically to middle.

Example


<html>
<head>
<style rel="stylesheet" type="text/css">
p {<!--   w ww.jav  a 2 s .  co m-->
font: 12pt arial;
}


img.middle {
vertical-align: middle;
}
</style>
</head>

<body>
<p><img class="middle" src="http://www.java2s.com/style/download.png"
alt="plane" width="74" height="74" />
The image is vertically aligned using the value middle </p>
</body>
</html>

Click to view the demo

The code above generates the following result.

Align image vertically to middle in HTML and CSS