HTML - Tags

  »   HTML  »   HTML Tutorial - Tags and attributes

A browser read absolutely all you write in the HTML document. Tags have three parts as I said before, the opening, closing, and content.

As you will learn there are hundreds of HTML tags. Absolutely all the elements that will be displayed by a browser need a tag or two.

html<openingtag>Content</closingtag> 
<p>Paragraph</p>

Tags are written in small letters. This is the standard of writing in XHTML, and Dynamic HTML.

Above are some examples of tags in HTML.

html<body> 
<!--acts as a capsule on the content.-->

	<p>paragraph</p>
	<h2>Title (heading)</h2>
	<i>italic</i>
	<b>bold</b>

</body>

Exceptions - tags that do not require closing tag

There are some tags that do not meet the model shown above. The reason is that in fact, these tags do not have content. Due to this fact, we will use a modified manner of writing these tags.

The simplest example is "linebreak"

html<be />

This tag combines the two tags, opening, and closing. This way is more efficient to use. The line break is used to tell the browser that we want to get down a line below, but not the closing paragraph.

Following this example, other tags have been modified to be written in a simpler and quicker way.

html<img src="../img/image.jpg" /> -- Image Tag --

<br /> -- Line Break Tag --

<input type="text" size="12" /> -- Input Field --

As you can see the browser is able to reproduce the image as long as we provide the location using the attribute "src". More about this in the next tutorial.