Continue

 Core Attributes

The four core attributes that can be used on the majority of HTML elements (although not all) are:

  • Id
  • Title
  • Class
  •  Style

The Id Attribute

The id attribute of an HTML tag can be used to uniquely identify any element within an HTML page. There are two primary reasons that you might want to use an id attribute on an element:

• If an element carries an id attribute as a unique identifier, it is possible to identify just that element and its content.

• If you have two elements of the same name within a Web page (or style sheet),you can use the id attribute to distinguish between elements that have the same name.

We will discuss style sheet in separate tutorial. For now, let's use the id attribute to distinguish between two paragraph elements as shown below.

Example

<p id="html">This para explains what is HTML</p>

<p id="css">This para explains what is Cascading Style Sheet</p>

Comments

Popular Posts