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 ()

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

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

<div>

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.

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

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

MORE CSS PROPERTIES

Introduction to Batch File Viruses

CODING WEB PAGES (HTML, CSS, & JavaScript)

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