HTML5 Attributes

HTML5 elements can contain attributes and gets added to an HTML start tag. HTML5 Attributes are used to set properties of a specific element.

If you have an idea about name-value pairs, then it would be easier for you to understand how to work with attributes. Here’s an example,

<HTML_tag HTML_Attribute="value">...</tag>

Here,

  • HTML_Tag is the HTML tag i.e. element, for example <img>, <div>, <h1>
  • HTML_Attribute is the attribute, which provides value, for example, id, class, href, etc.

HTML5 Attributes

Some of the examples are given below,

<a href=”https://studyopedia.com”>Studyopedia</a>

As you can see above, href is our attribute for the element a. The href attribute provides the URL.

Another example,

<img  src="/studyopedia-logo.png" alt="logo" width="50" height="80" />

As you can see above, src is our attribute for the element img. The src attribute specifies the URL of the image.

HTML5 Introduction
HTML5 Code structure
Studyopedia Editorial Staff
[email protected]

We work to create programming tutorials for all.

No Comments

Post A Comment