Introduction to CSS
Component of CSS
If we want to align any element vertically than through this property of CSS we can align it vertically. But as we have discussed previously in display property. So here also this property we can use in Block and inline-block elements not in inline elements.
Let's understand this by the following program:-
Text-top alignment.
Text-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