text-align
excluded) and some form elements. These include the following:Property Name | Some Possible Values | What It Does |
---|---|---|
float | left | right | Aligns block element |
text-align | left | center | right | justify | Aligns text |
float
property can be used to align an entire block element to the left or right such that other content flows around it. It works exactly the same way as the HTML align attribute applies to the img element. Hence, if a block element is floated to the left, content will flow along its right side. Conversely, if the block element is floated to the right, content will flow along its left side. Naturally, the width of the floated element will have to be set smaller than that of its container in order to see the float in effect. <div>
<div style="float: left; width: 35%;">
This div is floated left.
</div>
This text flows along the right side of the floated div...
</div>
<div>
<div style="float: right; width: 35%;">
This div is floated right.
</div>
This text flows along the left side of the floated div...
</div>
text-align
property to define whether the content of a block element is aligned to the left, right, in the center or justified to both margins. The content typically refers to text but can also apply to images and other block elements (the latter applies to Internet Explorer only). This essentially replaces the align
attribute in HTML as it applies to positioning the content of a block element. The value can be one of the following:left
- The text is aligned to the left.center
- The text is aligned in the center.right
- The text is aligned to the right.justify
- The text is aligned to both the left and right.text-align: justify;
[NOTE: If you're still unclear what 'justified' means then the text on this web page can serve as an example. Notice how it is aligned (squared off) on both the left and right sides.]
Free Text Editors
Free Graphics Editors
Website Analysis Tools
Free Website Templates
See also:
Best Free Web Hosting
How to Make a Web Page
If you need a .COM web address, you can get one quick and easy at...
<~ BACK | TOP | NEXT ~> |