What is a Tag?
Tag – Basic HTML component that describes to the Web browser how to display information or instructions. A pair of chevrons < > always surrounds the command.
HTML tags are the hidden keywords within a web page that define how your web browser must format and display the content.
Firstly, HTML is short for “HyperText Markup Language”. That may sound scary, but it simply means it is a language for describing web-pages using ordinary text. HTML is not a complex programming language.
Every web page is actually a HTML file. Each HTML file is just a plain-text file, but with a .html file extension instead of .txt, and is made up of many HTML tags as well as the content for a web page.
A web site will often contain many html files that link to each other. You can edit HTML files with your favorite editor.
Most tags must have two parts, an opening and a closing part. For example,
<html> is the opening tag and
</html>is the closing tags. Note that the closing tags has the same text as the opening tags, but has an additional forward-slash ( / ) character. I tend to interpret this as the “end” or “close” character.
There are some tags that are an exception to this rule, and where a closing tags is not required. The
<img> tag for showing images is one example of this.
Each HTML file must have the essential tags for it to be valid, so that web browsers can understand it and display it correctly.
The rest of the HTML file can contain as little or as many tags as you want to display your content.
Attributes allow you to customize a tags, and are defined within the opening tag, for example:
<img src="image1.jpg"> or
<p align="center"> ... </p>
Attributes are often assigned a value using the equals sign, such as
width="50%", but there are some that only need to be declared in the tags like this:
Most attributes are optional for most tags, and are only used when you want to change something about the default way a tag is displayed by the browser. However, some tags such as the
<img> tags has required attributes such as
alt which are needed in order for the browser to display the web page properly.