CSS Tutorial





Español Français 中文 Deutsch Portuguese Japanese nederlands
   
 
CSS Topics
css tutorials Introduction
Types Types
Background Properties Background Properties
Text Properties Text Properties
Font Properties Font Properties
Box Properties BOX Properties
Border Properties Border Properties
Margin Properties Margin Properties
Padding Properties Padding Properties
Special Topics Special Topics
Forums Ask Your Doubts
Scraps More about CSS
Feedback Feedback
 




CSS Vertical Alignment


Tutorials »Css »

Topic

How to create a base text or power text?
How to create a subline or super text?



Explanation


Property: Vertical Alignment

Usage:
vertical-align: baseline;
vertical-align: sub;
vertical-align: super;
vertical-align: 50%;
vertical-align: pt | px | cm;

Definition:
Using this attribute we can decorate out text. To create base and power text.
It takes the following values.
a)baseline : This text will be shown normal.
b)sub : This text will be shown as a sub text. It will lie beneath / below normal text.
c)super : This text will be shown as a super text. It will lie above normal text level.
d)% : The value can be set in percentage as 50%, etc...
e)pt | px | cm : The value can be set in points or pixels or cm

Example 1:
The following is a <font style="vertical-align: baseline;"> Inline Text </font> Example.

Result:
The following is a Inline Text Example.


Example 2:
The following is a <font style="vertical-align: sub;"> Sub line Text </font> Example.

Result:

The following is a Sub line Text Example.


Example 3:
The following is a <font style="vertical-align: super;"> Supper Line Text </font> Example.

Result:
The following is a Super Line Text Example.


Example 4:
The following is a <font style="vertical-align: -10px;"> Pixel </font> Example.

Result:
The following is a Pixel Example.


Note: To get subline text we have to set values in negative. This rule is same for %,pt and cm. In the above example instead of px we can use pt(points) or cm(centimeters) or % (percentage) based values too.




A Note
CSS - Cascading Style Sheets can be used along with html tags as explained in this site. This simple CSS will help you to create much elegant and neat html web pages. This does not need any additional softwares or codings. All web browser are capable of handing CSS codes.

Note 2: If required you can using <span> instead of <div> tags. div tag will start and end on new lines. span will not exceed the tag area.
Other Links

web hosting