This tutorial is about how you can align text and images with HTML and it will guide you about the aligning techniques used in HTML. In HTML, the attribute used for aligning TEXT or images is named as ‘align’.
However this attribute is not supported by HTML 5. Using this attribute we can align images to the top,bottom, left right or middle of the HTML page.
For eg: to align the image at bottom of the page, ‘align-bottom’ is used inside the image tag,
Similarly align-top,align-left,align-center and align-right are used for aligning the image to top,left,center and right positions respectively.
Texts can be aligned to right,center and left of the Page using the same ‘align’ attribute inside div tag.
Step 1: Align Image to the right side of a web page
To align text and image with html,the required position is written alongwith the align keyword
To align the image at right side of the web page, just add ‘align-right’ in the image tag.
After this,the image will be aligned to the right side of the page.
Step 2: Align Text in HTML
We can align any Text in HTML to the bottom, top, left or center using the align-bottom, align-top, align-left and align-center attribute respectively inside the div tag.
Same syntax is used to align text in html table
Step 3: Align Text to the right side of a web page
To align text in html table or web page and move it towards the right side, just add ‘align-right’ in the div tag (or inside table align tag in the case of table).
After this,you can see that the text has moved to the right side of the web page.
Step 4: Align Text to the left side of a web page
A Text in HTML can be aligned to the left side of the web page using the property align- left. In order to align the text, add the align- left property in the div tag. This will align the text to the left side of the web page.