HTML tag

From Dharmasphere

Jump to: navigation, search

Html-source-code3.png

HTML (HyperText Markup Language) - the language used for writing web pages - is a collection of tags, which give specific information about the text on the page. The tags usually enclose the text that they are describing.

Contents

Opening & Closing Tags

Tags are usually used in this way:

<tag>Some piece of text</tag>

This contains three parts, which are collectively called an HTML element:

  • An opening tag: <tag>. This starts with a < (less than) symbol and ends with a > (greater than) symbol.
  • The piece of text we are describing: Some piece of text
  • A closing tag: </tag>. This is exactly the same as the opening tag, except that it contains a / (forward-slash) symbol.

Here is an example, using the <p> paragraph tag:

<p>This is a paragraph about stuff.</p>

Self-Closing Tags

Some tags do not need to enclose any text, so there is no need to have a separate opening and closing tag. For example, the <img> tag, which is used for including images in a web page:

<img src="mydog.jpg" alt="Photo of my dog" />

The Importance of Tags

This is essentially the way that we mark up text in HTML and other, related languages. Once we learn a few basic tags, we can start creating HTML documents that can be recognised by web browsers all over the world.

See Also

External Links

Personal tools