Alignment CSS properties: So far all our HTML elements have been in the same position on our page. The text-align and float CSS properties allow you to align (another way of saying position) text and other HTML elements on your page.

The text-align property lets you position your text to the left, right or centre of your page. Remember to use the American spelling “center” and include the hyphen ()

 <div style="text-align: center;">
 Hello world with alignment......
 <p>Hello World without alignment.....</p>

Sample output of above code:

Hello world with alignment……

Hello World without alignment…..

We can also use CSS to position HTML elements, such as a


tags or images, to the left or right of the page. You use the float CSS property and set the value to the left or right.

 <div style="float: right;">
 The Hello world program:<br/>
 <img src="img3432.jpg" alt="The Hello world program"/>

The text-align and float CSS properties are easy ways to create an interesting layout for your web page.

Related Posts:

How do I install plugins in WordPress?

WordPress Posts vs Pages


Introduction to Batch File Viruses


CODING WITH CSS: The style attribute

Tips and tricks for USING THE DOM API

Tips and Tricks for WRITING JAVASCRIPT code

Where Kids Learn to Code.

Redirect New Registered Users to a Specific Page – WordPress

Build to-do list web-app with code

Using more than one CSS property

Building a web page with HTML tags

The color CSS property