Friday, September 17, 2021

HTML 101: Attributes

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:
                  src – The src attribute is used to specify the           location or URL of a particular image (defined by the <img> element).

                 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

HTML 101: Form

  I believe that everyone who has made use of the internet knows what a form is but in case you don't know, a form is a way of receiving...