Here we are showing you few HTML examples.Dont't worry if you don't know about these.We will be explaining these in latter chapters.These are examples just to make you familiar with HTML.

HTML syntax

  1. Every HTML document starts with a <!DOCTYPE html>
  2. Every HTML documents main part bagins with <html> and ends withs </html>.
  3. Visible of part of HTML document is written between <body> and </body> tags.
  4. Every HTML tag starts with tags in <> and ends with </>.

Example:

<!DOCTYPE html>
<html>
<body>
<h1>This is heading.</h1>
<p>This is paragraph.Paragraphs are different from headings.</p>
</body>
</html>

Headings in HTML

Headings in HTML range from <h1> to <h6>.

Example:

<!DOCTYPE html>
<html>
<body>
<h1>This is heading.</h1>
<h2>This is heading.</h2>
<h3>This is heading.</h3>
<h4>This is heading.</h4>
<h5>This is heading.</h5>
<h6>This is heading.</h6>
</body>
</html>

Output:

This is heading.

This is heading.

This is heading.

This is heading.

This is heading.
This is heading.

Paragraphs in HTML

Paragraph tag in HTML starts with <p> and ends with </p>.

Example:

<!DOCTYPE html>
<html>
<body>
<p>This is a paragraph.</p>
<p>This is second paragraph.</p>
<p>This is third paragraph.</p>
</body>
</html>

Output:

This is paragraph.

This is second pargraph.

This is third pargraph.

Links in HTML

Link tag in HTML starts with <a> and ends with </a>.

Example:

<!DOCTYPE html>
<html>
<body>
<a href="http://www.codehunt.com">This is link.</a>
</body>
</html>

Output:

Images in HTML

In HTML <img> defines images.
For images following points are needed to be kept in mind.
  • <img> defines image content.
  • src in HTML defines source file in HTML.
  • alt element defines alternative text that is to be diplayed when image is not loaded.
  • width and height attributes can also be used for defining required height and width of image.

Example:

<!DOCTYPE html>
<html>
<body>
<img src="logo.jpg" alt="CODEhunt" width="104" height="142" >
</body>
</html>

Output:

CODEhunt