We have covered in the Introduction to HTML that it is a markup language. A markup language consists of tags to identify its elements. The Elements define the structure of an HTML Page. We will discuss elements and tags below, with some basic examples.
Tags are texts which are usually contained within the symbols “<” and “>”. There are two types of tags, the opening tag and the closing tag. The closing tag is same as the opening tag, except that it also as a “/” following the “<“. HTML tags can be denoted in the format as below:
<tagname> Content </tagname>
An example can be the tag “<h1>Heading</h1>“. The tag h1 denotes that text inside is the first heading. There can be headings from h1 to h6, with h1 being the largest and h6 being the smallest of all.
An element in HTML are the content that form the web page. More clearly, an element is everything starting from the open tag and ending at the close tag, including the tags themselves. As an example
“<p>This is a paragraph</p>”
It is said that all elements should have an opening and close tag. There are though some tags, which do not contain any element within or are empty elements. These in themselves are open and close tags. They can be written just like an open tag in some versions of HTML, but some require that a “/” is put before the “>” symbol. An example is <br/>. This is the tag for line break. If a browser comes across this symbol, it will display the rest of the text in the next line. It is a good practice to follow the latter convention, because this works in all version of HTML.
It is also a good practice to always use lower case for all HTML tags, because while most are not case sensitive, there are some that prefer a lower case.