HTML attribute gives additional information to the element.
Generally we use HTML elements in simplest form but using attributes we can control how it's content looks, size of content,position of content and can provide other useful information.
HTML attribute is only specified in the starting tag.
The attribute has two properties:
- name: - name is the first part of the attribute which specifies the name of the attribute.
- value: - value is the second part of the attribute and it contains value of the attribute.
HTML core attribute
There are few attributes which can be used with most of the HTML element.These attributes are:
1).HTML style attribute
The style attribute allows us to use inline CSS in our element.
Using style attribute we can add almost all CSS property to the element.
2).HTML class attribute
The class attribute can be used in almost all HTML elements.
When a class is defined in any HTML element then that element contains all the property mentioned for that class.
3).HTML id attribute
The id attribute is used to uniquely identify any HTML element.
4).HTML title tag
The title tag is used to provide additional information to the content of the element.
It shows the information provided when you take the mouse pointer over it.
HTML href Attribute
In <a> tag href attribute is used to specify the address of the link.
HTML src Attribute
src attribute is used to define file location in <img> tag.