i2tutorials

CSS Vertical Align

CSS Vertical Align

 

CSS vertical-align property is used to provide the vertical alignment of an inline or table-cell box.

 

CSS Vertical Align Values:

 

 

Example:

 

<!DOCTYPE html> 

<html> 
<head> 
<style> 
img.top { 
  vertical-align: text-top; 
} 
img.bottom { 
  vertical-align: text-bottom; 
} 
</style> 
</head> 
<body> 
<p><img src="good-morning.jpg" alt="Good Morning Friends"/> Default alignment.</p>  
<p><img src="good-morning.jpg" class="top" alt="Good Morning Friends"/> Text-top alignment.</p>  
<p><img src="good-morning.jpg" class="bottom" alt="Good Morning Friends"/> Text-bottom alignment.</p> 
</body> 
</html>

 

OUTPUT:

 

CSS Vertical Align

 

Exit mobile version