In the previous article, named "Changing appearance", we saw how HTML tags are used to change the appearance in an HTML document. The HTML documents are basically made up of these tags which are nothing but, elements. The element defines the different tags across the HTML document.
Within the various tags there are various parameters followed by values. These parameters or arguments within the elements are technically known as attributes.
Figure shows the font element with its attributes and values along with contents. This element formats the contents using values specified within the given attributes.
Attributes are always specified within starting tags, not within ending tags.
Although it is not mandatory, the element names and attribute names must be of lower case. The values of attributes must be specified within double quotes, even if it is not mandatory. It is because, some browsers follow strict conventions.
One can use single quotes instead of double quotes in some situations, where the value contains double quotes. But, use of double quotes is preferred over the use of single quotes.
<p title='Team ICanTech.In is developing the "ProgrammingBasics.In" website'>
The title attribute of p is assigned a value of 'Team ICanTech.In is developing the "ProgrammingBasics.In" website. Since, the value ProgrammingBasics.In is within double quotes, one cannot use double quotes while assigning the value and hence single quotes are used.
Attributes are separated by space after specifying value. The starting attribute is the first one which is also specified, separated by a space after specifying the particular tag element.
The contents to be rendered on web page is specified after closing the > bracket and in between the opening and closing tags.
Note: Not all tags render contents specified. There some tags which does not render the contents, at all. Such tags are well known as supporting tags. They support some functionality in web pages from the background.