The following code shows a simple example of an HTML element applied to some text.


The start tag is <code>, and the end tag is </code>. Between the tags is the element's content, which is web. Together, the tags and the content form the code element.

We use the elements to do the following:

  • Elements tell the browser about your content.
  • The effect of the element is applied to the element contents.
  • Each of the HTML elements has a different and specific meaning. The code element, for example, represents a fragment of computer code.

HTML defines different types of element that fulfill various roles in an HTML document.

In general, the convention is to adopt a single case format and stick to it. The more common style has been to use lowercase characters throughout.

An HTML element usually consists of a start tag and end tag,

HTML elements can be nested (elements can contain elements).

All HTML documents consist of nested HTML elements.

some tag will be show below:

          	<!DOCTYPE html>
			<h1>My First Heading</h1>
			<p>My first paragraph.</p>

Never rely on this. It might produce unexpected results and/or errors if you forget the end tag.

Empty Elements

You are not required to place any content between the start and end tags.

If you don't, you create an empty element, like the one shown in the following code.

learn html in <code>studentsempire</code>

Not all elements make sense when they are empty, but even so, this is still valid HTML.

Self-Closing Tags

You can express empty elements more concisely by using a single tag

You combine the start and end tag into one-the stroke character (/) It is used to signify the start of the end tag.

The single tag is a more concise way of expressing the empty element.

Void Elements

There are some elements that must be expressed using a single tag. These are known as void elements.

One such element is br.

hr is a grouping element and is used to denote a paragraph-level break in the content.