HTML Attributes

Attributes are additional information provided by the HTML element.

HTML attributes

  • HTML elements can set attributes
  • Attributes can add additional information to the element
  • Attributes are generally described in the Starting Tag
  • Attributes always appear as name /value pairs, For example: name = "value" .

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 »

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'>

HTML attribute commonly refers to attribute value

Attribute values should always be enclosed in quotes.

Double quotes are most commonly used, but single quotes are fine.

Remark Hint: In some individual cases, such as the attribute value itself contains double Quotes, then you must use single quotes, for example: name = 'John "ShotGun" Nelson'

HTML tip: Use lowercase attributes

Attributes and attribute values are not case sensitive.

However, the World Wide Web Consortium recommends lowercase attributes /attribute values in its HTML 4 recommendations.

The new version of (X) HTML requires lowercase attributes.