HTML Attributes




HTML Attributes

Last Updated Jul 27, 2015, 11:00:08 PM

Elements in HTML have attributes; these are additional values that configure the elements or adjust their behavior in various ways to meet the criteria the users want.

HTML attributes provides additional information about the html elements

  • HTML elements can have attributes
  • Attributes provide additional information about an element
  • Attributes are always specified in the start tag

HTML Class Attribute

HTML elements can have one or more classes, separated by spaces. You can style elements using CSS by selecting them with their classes.

Example
Try It Now

HTML Id Attribtute

An HTML element can have an id attribute to identify it. id elements should always be unique to that single element, and each element should never have more than one id.

Example
Try It Now

HTML href Attribute

Links tell the browser where to go using an href attribute, which stores a URL.

Example
Watch GIF Try It Now

The title Attribute

The title attribute provides the information about what that paragraph contains


Watch GIF Try It Now

HTML Size Attribute

The html size attribute is used to provide the extra parameters to the img tag such as weight and height of the image


Watch GIF Try It Now

The alt Attribute

The alt attribute is used to display an alternative text if the images does not load


Try It Now

Browser Support
Property
Attributes (Yes) (Yes) (Yes) (Yes) (Yes) (Yes) (Yes)


Practice with Our Interactive Live Code Editor and Take your HTML Skills to the next level

Exercise 1 Exercise 2 Exercise 3 Exercise 4 Exercise 5 Exercise 6

Sources and Credits

The source of the content has been referred and updated with Mozilla Foundation and w3C

Last Updated Jul 27, 2015, 11:00:08 PM