An HTML document is a text file that consists of text and tags that mark the structure of the Web document. After receiving an HTML file, the browser will use these tags (also known as elements) to display text, multimedia objects, and hyperlinks.
An element is the most basic part of HTML. It consists of a start-tag, an end-tag, and the data characters enclosed by the two tags.
- A tag starts with a less-than (<) sign and ends with a greater-than (>) sign.
- An end-tag consists of the tag name immediately preceded by a slash (/).
- Some tags require that you always provide the matching end-tag.
- Others allow you to omit the end-tag if the result is clear and unambiguous.
Consider the following example of an HTML element:
<B>This sentence will be displayed in Bold</B>
As you should already know, <B> is the start-tag and </B> the end-tag.
It's also possible to have nested elements, by placing an entire element inside another, as in this example:
<B>This sentence <I>will</I> be displayed in Bold</B>
Additionally, some elements have attributes, which are qualifications of the element's meaning or optional parameters for that element:
<P ALIGN="CENTER">This is a centered paragraph.</P>