Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


HTML Basics: Basic Text Tags : Page 5

Learn the basic HTML tags to put in your pages and see just how easy HTML can be!




Building the Right Environment to Support AI, Machine Learning and Deep Learning


<h1-6 align=left/right/center>

The heading tag tells the browser to display the text that follows it as the specified type of heading.

Heading Levels

There are six different levels of headings, from H1 to H6. In their default format, H1 is larger than H2; H2 is larger than H3, and so on. Some levels of heading are bold, some are not. The exact default size and attribute you see depends on your browser. In addition, people who use a feature called Cascading Style Sheets (CSS), a text attribute tag, or the font tag can change the way you see different levels of headings.

You'll always need to close the heading tag, with an end heading tag, </h1-6>

Here's an example of a heading tag in use. This is a heading level 4:

<h4>Hello World!</h4>
How Are You?

It displays like this in a web browser:

Hello World!

How Are You?

Here are samples of the six different level of headings. We have used CSS to define how some of the headings look. The way they actually appear may vary from browser to browser.

  • Head 1

  • Head 2

  • Head 3

  • Head 4

  • Head 5
  • Head 6


The heading tag has one commonly-used attribute, align. Like the paragraph tag, you can align headings in three ways:

  1. The default is left. If you don't use the align switch, the text automatically aligns to the left margin.
  2. align=right sends the text to the right margin.
  3. align=center centers the text across the page.

HTML Code Result

<h4>Head Level 4, aligned left.</h4>

This heading is aligned to the left.

<h4 align=right>This paragraph is aligned right. Each line is flush to the right margin.</h4>

This paragraph is aligned right. Each line is flush to the right margin.

<h4 align=center>The paragraph is aligned center. Each line is centered and touches neither margin.</h4>

This paragraph is aligned center. Each line is centered and touches neither margin.

Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date