HTML Attribute

  • HTML attributes are special words that provide additional information about the HTML element or attributes.
  • The element or tags have attributes, which define the element’s behavior.
  • It also adds attributes with a start tag.
  • The Attribute with its name and meaning pair should always be added.
  • The names and values of the attributes are case sensitive. Hence, W3C recommends that they should be written in Lowercase only.
  • We can add multiple attributes to an HTML element, but we require some space between two attributes.

Syntax

Example

HTML5 Attribute

The title attribute in HTML

In most browsers the title attribute is used as a text tooltip. As user moves the cursor over a link or any document, it shows the content. To show the information of that connection or document, we can use it for any document or connection. We can take with paragraph tag and heading tag in our example.

Example

With <h1>tag:

With <p>tag:

Code:

HTML5 Attribute

The href attribute in HTML

The main attribute of < a > anchor tag is the href attribute.This attribute detects the link that is specified in the link. The href attribute provides a hyperlink, and if it is blank, it will remain in the same page.

Example

With link address:

Without link address

Code:

HTML5 Attribute

The src Attribute

The src attribute is one of the important and required attributes for the < img > element.It is the source of the image that needs to be displayed on the browser. The attribute contains image in the same or other directory.The name or source of the image should be right, otherwise the image will not be displayed by the user.

Example:

Code:

HTML5 Attribute

Pin It on Pinterest

Share This