×

Html & Html5

The World's best Software Development Study Portal

CSS3

Introduction to CSS


CSS White Space


Want to specify how to display the content within

Let's understand this by the following program:-


<!DOCTYPE html>

<html>

<head>

<style>

img.texttop {

      vertical-align: text-top;

}

img.textbottom {

      vertical-align: text-bottom;

}

</style>

</head>

<body>

<p> <img src="pythonimage/redfort.jpg" class="texttop" alt="Good Morning Friends"/> Text-top alignment. </p>

<p> <img src="pythonimage/redfort.jpg" class="textbottom" alt="Good Morning Friends>Text-bottom alignment</p>

</body>

</html>



Output of the Program



Text-top alignment.css training


css trainingText-bottom alignment.

So this is how we can align the items.


Some more values of vertical alignment property.These are mentioned below with description


Value Description
length It is used to increase or decrease length of the element by the specified length. negative values are also allowed.
% It is used to increase or decrease the element in a percent of the "line-height" property. negative values are allowed.
baseline It aligns the baseline of element with the baseline of parent element. This is a default value.
sub It aligns the element as if it was subscript.
super It aligns the element as if it was superscript.
top It aligns the top of the element with the top of the tallest element on the line.
bottom It aligns the bottom of the element with the lowest element on the line.
text-top the top of the element is aligned with the top of the parent element's font.
middle the element is placed in the middle of the parent element.
text-bottom the bottom of the element is aligned with the bottom of the parent element's font.
initial It sets this property to Its default value.
inherit inherits this property from Its parent element.





CSS 3 training insitute | Best IT Training classes in Gurgaon | Web Designing Training Institute