HTML Tags

HTML Tags

Sponsored Ads

An html document consist of elements, tags and attributes. Tags are an important part of an html document. In order to create a good html document you need to be familiar with html tags. You have to use the correct html tag for the correct purpose…

Sponsored Ads

Most html tags will have an opening tag and a closing tag. The content is written between the opening and closing tags. But some html tags will don’t have a closing tag. They are known as empty elements.

An Html tag is written in between a < sign and > sign. If it is a closing tag then a / is written before the > sign. For Eg: <p>

Here we introduce some basic html tags. Don’t worry we will learn all tags in detail later.

Paragraph tag

The tag for paragraph in html is <p>. The p tag gives a method to structure your text in different paragraphs.

Each paragraph text should be written in between the opening (<p>) and closing (</p>) tags as shown in the example.

Example

<!DOCTYPE html>
<html>
   <head>
      <title>Paragraph Example</title>
   </head>
   <body>
      <p>Here is a first paragraph</p>
      <p>Here is a second paragraph</p>
      <p>Here is a third paragraph</p>
   </body>
</html>

Now we will only write the content of the <body></body>  part as the other codes are repetitions.

Heading tag

Every document will have a heading. You also have main heading, sub heading, sub sub heading and so on. So as in html. In html we have 6 heading from <h1>……<h6>. <h1> being the most important heading and the <h6> the least important heading. But we normally use only 3 headings.

Sponsored Ads

Ideally a page should have one h1 heading and other subheadings.

Example

<h1>This is heading 1-the main heading</h1>
<h2>This is heading 2</h2>
<h3>This is heading 3</h3>
<h4>This is heading 4</h4>
<h5>This is heading 5</h5>
<h6>This is heading 6</h6>

Image tag

Html images re defined by the <img> tag

Example

<img src=”imagename.jpg”>

Line Break tag

<br /> is the tag for line break in html. When this tag is used anything that follows this tag will start in a new line. <br /> is an example of empty element since it dosent have a closing tag. It is a self-closing tag.

The <br /> tag has a space between the characters br and the forward slash. If you omit this space, older browsers will have trouble rendering the line break, while if you miss the forward slash character and just use <br> it is not valid in XHTML.

Sponsored Ads

Example

<p>Hello, This is a paragraph tag. <br /> This text will be printed in a new line</p>

Sponsored Ads

%d bloggers like this: