html basics

  • In this Chapter we will discuss some Basic level HTML Elements with Examples.

HTML Headings

  • HTML has six levels of headings, which use the elements <h1>,<h2>,<h3>,<h4>,<h5>, and <h6>.
  • HTML <h1> tag is most important heading tag.
  • HTML <h6> tag is least important heading tag.

Example:

< !DOCTYPE html>
<html lang="en-us">
<head>
<title>HTML Headings</title>
</head>
<body>
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<h4>Heading 4</h4>
<h5>Heading 5</h5>
<h6>Heading 6</h6>
</body>
</html>

HTML Paragraph

HTML <p> tag represents a paragraph. Paragraphs are usually represented in visual media as a block of text. Each paragraph text should go in between an opening and closing tag of the <p> element.

Example:

< !DOCTYPE html>
<html lang="en-us">
<head>
<title>HTML Paragraph</title>
</head>
<body>
<p>My First Paragraph</p>
<p>My Second Paragraph</p>
<p>My Third Paragraph</p>
</body>
</html>

Note: If we are using various <p> tags in one HTML file then browser automatically adds a single blank line between the two paragraphs.


HTML Images

HTML <img> tag represents a images. It is used to display the image on web page. Image tag is an empty tag that contains attributes only, closing tags are not necessary for HTML image element. The source file (src), alternative text (alt), (width) and (height) are provided as attributes.

Example:

< !DOCTYPE html>
<html lang="en-us">
<head>
<title>HTML Paragraph</title>
</head>
<body>
<h1>HTML Image</h1>
<img src="https://www.google.com/google.jpg" alt="Google Image" width="200" height="200"/>
</body>
</html>

HTML <br> and <hr> tags

  • HTML <br> tags respresents a line break. The <br> tag inserts a single line break.It is useful for writing address and poems. It is a empty tag which means that it has no end tag.
  • HTML <hr> tags represents a thematic break (horizontal rule). It draw the horizontal line between two paragraphs or content.

Example:

< !DOCTYPE html>
<html lang="en-us">
<head>
<title>HTML Paragraph</title>
</head>
<body>
<h1>HTML hr and br tag</h1>
<hr/>
<p>HTML <br/>Tutorial</p>
</body>
</html>

Next Topic: HTML Elements