Approx. read time: 1.5 min.
Post: Alignment CSS properties
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 (–)
[html] <body>
<div style="text-align: center;">
Hello world with alignment……
</div>
<p>Hello World without alignment…..</p>
</body>[/html]
Sample output of above code:
Hello World without alignment…..
We can also use CSS to position HTML elements, such as a
[html]<div>[/html]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.
[html] <body><div style="float: right;">
The Hello world program:<br/>
<img src="img3432.jpg" alt="The Hello world program"/>
</div>
</body>[/html]
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?
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
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