HTML Attributes

HTML Attributes

Well, attributes are just some extra information given with the start tags to specify something different for some particular tag. Like in the unordered lists, you get that disc bullets by default. But if you wish to have square bullets, you can surely have those, with the help of attribute. In such cases, you often need some attributes to get your work done.

Note that the attributes are always written in the starting tag. There are several attributes that can be used with different tags. Sometimes it is inevitable to use some attributes.

There are some tags with which you have to use some attributes, like the Img tag, with which you have to use the src attribute, which contains the URL of the image you want to add, and the alt attribute is used with it so that if in case the image is not displayed, the alt text will be displayed. There are many more attributes like Colspan(used with td and th), for(used with label), HREF(used with a), type, action(used with form), name(used with several tags to define their names), and many more.

Well, there are many other attributes that you can study, but the above-mentioned attributes are some of the frequently used attributes. There are some global attributes too, like the class and id, which we are going to see now.