Guidance portal

World of Guidance and Education

Html Attributes

What are "HTML Attributes"? The text on a web page can be aligned on left side, right side or center of the page. Same is true for an image. Aligning the text/image in left, right or center of the page is termed in HTML as "attributes".

Mostly, while writting text, headings and paragraph are aligned to enhance presentation of information provided on the page. So lets start to learn

  • How to align text "center"?
  • How to align text "right"?
  • How to align text on "left"?

HTML syntax for alignment and its explanation is shown below

     align="your required align "

"Your required align" menas center, right, left, middle, bottom and top. The terms are self explanatory.

How to use Alignment syntax?

For heading or paragraph to be aligned, start the opening tag of heading or paragraph and write the alignment syntax in the tag before putting the increment sign (">"). (as shown in examples below)

We have used the example of heading to demonstrate the alignment but same is true for paragraph alignment.

Align center:

If you want to align the heading in center, the code is shown below. Please note that how before putting the increment sign (">") alignment sytanx is written. (For your attention it has been shown in red).

     <h2 align="center">
    your word for align center

Align right :

For right alignment, the syntax is same; just change the name of alignment. Please note how "center has been replaced with "right" for changing alignment. (For your attention it has been shown in red).

     <h2 align="right">
    your word for align right

Align left :

For the left align write the "left" in syntax of html, rest is same as shown above.

     <h2 align="left">
    your word for align right


Actually now a days all formating is done with CSS (programming language).

Lets put all the coding togather to see how it looks like on browser.


    <title>OUR FIRST WEB PAGE</title>

    <h2 align="left">your word for align left </h2>
    <h2 align="right">your word for align right </h2>
    <h2 align="center">your word for align center</h2>

    browser view


comments powered by Disqus