HTML - <i> Tag



The HTML <i> tag is used to display the content in italic style is generally used for the important words in the different languages and also for the technical terms. This <i> tag represents a range of text that is set off from the normal text for some reason.

For example − If we are writing content within a paragraph element but an important word or different language comes in the content, we can use the <i> tag to highlight the important word.

Syntax

Following is the syntax of the <i> tag −

<i> content </i>

Example

In this following example, let’s see the usage of <i> tag how it will work in the HTML document.

<!DOCTYPE html>
<html>
<body>
   <h2>
      <i>This one is italic text −</i>
   </h2>
   <p>I looked at it and thought <i>This can't be real! </i>
   </p>
   <p>The term <i>bandwidth</i> describes the measure of how much information can pass through a data connection in a given amount of time. </p>
</body>
</html>

When we run the above code, it will generate an output which shows the italic text between the paragraphs.

Example

Considering the following example, where we are creating an HTML document and using the <i> tag to create italic text and also using the style properties to make the italic text stylish, as follows −

<!DOCTYPE html>
<html>
<head>
   <style>
      i {
      color: red;
      }
   </style>
</head>
<body>
   <h2>
      <i>This one is italic text −</i>
   </h2>
   <p>I looked at it and thought <i>This can't be real!</i>
   </p>
   <p>The term <i>bandwidth</i> describes the measure of how much information can pass through a data connection in a given amount of time. </p>
</body>
</html>

On running the above code, the output will pop up displaying the text with a applied CSS properties on the webpage.

Example

Let's look into the another scenario, where we are going to use the <i> in text to indicate that is of different language

<!DOCTYPE html>
<html>
<head>
   <style>
      i {
      color: red;
      }
   </style>
</head>
<body>
   <p>The Latin phrase <i lang="la">Veni, vidi, vici</i> is often mentioned in music, art, and literature. </p>
</body>
</html>

When we run the above code, it will generate an output displaying the the text which is marked and italic applied on the webpage.

html_tags_reference.htm
Advertisements