HTML Core Attributes

Eduaction Management 959 Lahore

Code With Jahangir 

HTML Core Attributes

FREE COURSES 

FREE CERTIFICATE

HTML Core Attributes

The most widely used attribute is core attributes. There are 4 types of core attributes:

  •       Id
  •       Class
  •       Title
  •      Style

 

The Id Attribute:

This is the most widely used attribute. The id attribute is used to give a unique id to an HTML element. Each element in HTML with an id attribute has its own unique identity, just as each of us has our own unique identity. Multiple elements can’t share the same id. 

For example: 

<p id= "html"> This is HTML tutorial </p>
<p id= “python”> This is Python tutorial </p>

In the above example, it is easy to distinguish the two paragraphs with the name- id attribute having two different values i.e. html and python.

 

 

The class Attribute:

The class attribute is used to specify a class to an HTML element. It is not unique like the id attribute. Multiple elements can share the same class. It is used to associate an element with a stylesheet, JS.

 

 

The title Attribute:

The id attribute is used to give a title to an HTML element. When the HTML element is loading, a tooltip of the cursor comes and shows the written title. 

 For example:

<h4 title= “hello, motto”> TITLE ATTRIBUTE</p>

 

Output:

TITLE ATTRIBUTE

 

 

The style Attribute:

The style attribute is used to give styling to an HTML element. It is a property of CSS (Cascading Style Sheet). It is mainly used by the CSS. It is the inline property of an element. In CSS, if we want to style within an HTML element we use the style attribute in inline of an HTML element.

Eduaction Management 959 Lahore

Code With Jahangir 

HTML Core Attributes

FREE COURSES 

FREE CERTIFICATE

Previous Post Next Post

Contact Form