HTML Element Style How to - Align image with text








Question

We would like to know how to align image with text.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
img {<!--  w w  w . java 2  s.c  om-->
  vertical-align: middle
}
</style>
</head>
<body>
  Some text here
  <img src="http://www.java2s.com/style/download.png"> and here
</body>
</html>

The code above is rendered as follows: