HTML Attributes

Attributes give extra data about HTML elements.

What is HTML Attributes

  • It can have attributes
  • HTML Attributes give additional information around an element
  • HTML Attributes are constantly indicated in the begin tag
  • HTML Attributes come in esteem/name sets like: value="name"

The lang Attribute

The report language can be announced in the <html> tag.

The language is pronounced in the lang attribute.

Declaring a language is imperative for openness applications (screen perusers) and inquiry engines

<!DOCTYPE html>
<html lang="en-US">

<h1>My First Heading</h1>
<p>My first paragraph.</p>


The title Attribute

HTML passages are characterized with the <p> tag.

In this model, the <p> component has a title characteristic. The estimation of the quality is "About welookups":


<p title="About welookups">
welookups is a web engineer's site.
It gives instructional exercises
of web programming,
including HTML, CSS, JavaScript, XML, SQL, PHP, ASP, etc.
Try it Yourself »

what is The href Attribute

HTML joins are characterized with the <a> tag. The connection address is indicated in the href attribute


<a href="http://www.welookups.com">This is a link</a>
Try it yourself »

Size Attributes

HTML pictures are characterized with the <img> tag.

The filename of the source (src), and the extent of the picture (width what's more, height) are altogether given as attributes:


<img src="welookups.jpg" width="104" height="142">
Try it Yourself »

The picture measure is determined in pixels: width="104" implies 104 screen pixels wide.

You will get familiar with pictures and the <img> label later in this tutorial.

The alt Attribute

The alt trait indicates an elective content to be utilized, when a HTML component can't be displayed.

The estimation of the trait can be perused by "screen readers". Thusly, somebody "listening" to the site page, for example a visually impaired individual, can "hear" the element.


<img src="welookups.jpg" alt="welookups.com" width="104" height="142">
Try it Yourself »

We Suggest: Always Use Lowercase Attributes

The HTML5 standard does not require lower case trait names.

The title characteristic can be composed with upper or lower case like Title as well as TITLE.

W3C recommends lowercase in HTML4, and demands lowercase for stricter record types like XHTML.

We Suggest: Always Quote Attribute Values

The HTML5 standard does not require cites around characteristic values.

The href trait, exhibited above, can be composed as:


<a href=http://www.welookups.com>
Try it Yourself »

W3C recommends cites in HTML4, and demands cites for stricter report types like XHTML.

Sometimes it is necessary to utilize cites. This won't show effectively, in light of the fact that it contains a space:


<p title=About welookups>
Try it Yourself »

Single or Double Quotes?

single style can utilize however Double style quote are regular HTML

atribute contain twofold quotes,it is important to utilize single statements

<p title='John "ShotGun" Nelson'>