You can set the alignment of any HTML element using the
text-align style rule. text-align can be used to set the alignment for a paragraph, a section of the document, or even the whole document. text-align can be used to set alignment to left, right, center, or justified.
For example, suppose we want to center a paragraph. First, we'll create a styles class called section of the document:
centeralign by putting the following code into the <HEAD><STYLE TYPE="text/css">
<!--
.centeralign {text-align:center}
-->
</STYLE>
Now we can set any paragraph to
centeralign class like this:<P CLASS="centeralign">
Get Centered
</P>
which gives us
Get Centered
We can apply the same class to a element to center a section of the page:
<DIV ...><DIV CLASS="centeralign">
This is a center aligned bunch of text
<P>
It stays center aligned because it is within
a DIV which has a center aligned style.
<P>
Each element within the center aligned DIV
inherits the center aligned style.
</DIV>
which gives us
This is a center aligned bunch of text
It stays center aligned because it is within a DIV which has a center aligned style.
Each element within the center aligned DIV inherits the center aligned style.

0 comments:
Post a Comment