HTML Tags Web development basics

HTML attributes

HTML attributes are used to define characteristics of a HTML element.

HTML attributes-features

  • All HTML elements can have attributes
  • Attributes provide additional information about that element
  • Html attributes are always specified in start tag
  • Attributes usually have two parts: name=”value”. 

Name refers to the name of the property you wish to set. For example, one wants to align <p> , the property alginmnet is named as align.

Value is the value assigned to the property. For example <p> aligned to right, the value will be right.

this is right aligned

this is center aligned

this is left aligned

The lang attribute

The language of document should be decalared. The language is decalred in the <html> tag. The language is declared using lang  attribute.

Th href attribute

Html links are specified in <a> tag.The link address is defined by using href attribute.

The title attribute

A title attribute is added to <p> tag.The value of title attribute is displayd as a tooltip on mover over on paragraph.

this is a paragraph with title attribute that will be shown as tooltip.

Size attributes

The size attributes has two properties height that specifies the heigth for an element and width that js used to specifiy width of an element.

The alt attribute

Alt attribute is used to provide an alternate text for image, when it cannot be displayed on screen. The text in alt can be read by screen users.

id and class attributes

id and class attributes specify name of class and id for that element.

These can be used to apply java script or styling to elements.They can be applied to all HTML elements.