What’s an attribute in HTML/XHTML ?
An attribute is an additional behavior or property of an element. It is specified within an element like title attribute, language attribute, Href attribute etc.
Example : <a href=”https://www.webdesignreference.com/” title=”home-link”>This is a home page link</a>
Here “Href” and “title” are additional behaviour of an element.
There are some common Attribute in HTML/XHTML:
- Class : It is used for defining class of an element.
- Id : It specifies id or name of an element.
- Style: this behaviour is used for styling of an element.
- Title : It is used for title or tooltip of an element.
- Alt: It is used for alternate text of an image.
- Src: This is used for source path of an image.
- value : It specifies the value of an element.
- Href : It specifies the link url.
There are some new Attribute in XHTML :
- Dir : It specifies the direction of text.
- Lang : It specifies the language of html document.
- Accesskey : It specifies a keyboard short-cut to access an element.
- Contenteditable : It allows to edit the content by user in a html document.
- Tabindex : It specifies the tab index or tab order of an element.
- Unselectable : It specifies the on off property of an element that means content displayed or not.
- Hidefocus : It is used for hide focus of an element in html document.
- Disabled : It is used for disable the action of an element.