HTML attributes are special words that are used inside an HTML page's opening tag to control an element's behavior.
Types of HTML attributes:
- Class attributes: this attribute can be accessed by any element and is useful to identify a group of elements in an HTML document together. These elements can be styled using CSS or actions can be performed on them using JavaScript.
- ID attributes: We use HTML id attribute to uniquely identify a particular element in the HTML document. It also acts as a distinguisher between two or more elements with the same name.
- Style attributes: they are used to implement inline CSS codes in HTML
- Title attributes: this attribute is used to give an identifier to the tag or elements. When a title is set it is usually seen once a mouse hovers over the element in question
- Lang attributes: This attribute is used to specify the language of the HTML document and is used with the <html> element.
- Href attributes: it is used to identify the URL of the destination address
- Image attributes:
alt – We use it to specify some alternative text related to the image which is displayed if the user cannot view the image due to some inevitable reasons.
height – It is for specifing the height of the image in pixels.
width – It is useful to specify the width of the image in pixels.
There are still a long list of attributes which would be covered during the course
No comments:
Post a Comment