'Coding has over 700 languages', '67% of programming jobs aren’t in the technology industry', 'Coding is behind almost everything that is powered by electricity'
Last Updated: Sep 22, 2023
Easy

HTML <i> tag

gp-icon
Basics of javascript
Free guided path
10 chapters
68+ problems
gp-badge
Earn badges and level up

Introduction

Do you know how we can display content in italic style in HTML? Do you know how we can use HTML i tag while making websites? If not, then don’t worry. We are here to clear all of your doubts.

html i tag

In this article, we will discuss about HTML <i> tag. We will also discuss the syntax of it. In the end, we will also discuss about its uses. Moving forward, let's first discuss about HTML.

What is HTML?

HTML stands for Hyper Text Markup Language. It is used to create web pages of websites. It basically describes the whole structure of a web page. There are various elements in HTML that help browsers in displaying the content.                                         

Some basic elements of HTML are header tags(<h1> , <h2> , <h3> , <h4> , <h5> , <h6>), (<p>)  paragraph tag and many more. HTML tags are useful in converting HTML documents into web pages. Moving forward, let’s understand about HTML i tag.

Get the tech career you deserve, faster!
Connect with our expert counsellors to understand how to hack your way to success
User rating 4.7/5
1:1 doubt support
95% placement record
Akash Pal
Senior Software Engineer
326% Hike After Job Bootcamp
Himanshu Gusain
Programmer Analyst
32 LPA After Job Bootcamp
After Job
Bootcamp

What is HTML i Tag?

The HTML i tag is used to write any text in italics. In a paragraph, if we want to focus on a particular word, then we can write that text in italics using the i tag. It is used to highlight certain texts from the rest of the text. Moving forward, let’s see the syntax of the HTML i tag.

Syntax of HTML i Tag

The syntax of HTML i tag is as follows:

To write any text in italics in HTML, we use <i>. The text is enclosed inside <i>(opening) and </i>(closing) tags. For example, 

<i> Hello Ninjas </i>

Moving forward, let’s discuss the steps to run HTML code.

Steps to Run HTML Code

The steps to run HTML code are as follows:

1. Open notepad and write your HTML code. For example, let’s make a webpage to display “Hello Ninjas” in italics.

Notepad File

You can directly paste the below code.

<!DOCTYPE html>
<html lang="en">
<head>
    <title>HTML i Tag</title>
</head>
<body>
    <i>Hello Ninjas</i>
</body>
</html>

2. Save this file with a .html extension.

Saving file with .html extension

3. Now, to view the output in your browser, copy the path of this file and paste it. Or you can directly double click on created ninja.html file. 
 

4. You will see the below output.                

Output Screen

Sample Web page

Let’s make a web page to understand HTML i tag more clearly

Code

<!DOCTYPE html>
<html lang="en">
<head>
    <title>HTML i Tag</title>
</head>
<body>
    <h1> Hello Ninjas </h1>
    <p> World has enough coders. Be more than a coder 
    <i> Be a Coding Ninja!!! </i> Let the jobs chase you.</p>
</body>
</html>

Output

Output Screen

Explanation

In the above code, we have used HTML i tag to highlight the phrase “Be a Coding Ninja!!!” 

Have you ever thought about what if we don't have i tag, then how we can do that?

Then we can do this with the help of CSS. In the below code, we are using inline CSS:

Code

<!DOCTYPE html>
<html lang="en">
<head>
    <title>HTML i Tag</title>
</head>
<body>
    <h6> Italic Text with CSS </h6>
    <p style="font-style: italic;"> Hello Ninjas </p>
</body>
</html>

Output

Output Screen

Uses of HTML i Tag

Following are the uses of HTML i tag:

  1. We generally use HTML i tag to write technical terms in italics in any document.
     
  2. It is highly used while writing poetry and creative content. 
     
  3. HTML i tag plays an important role while writing phrases and thoughts. Phrases and thoughts are mostly written in italics so that they can be easily highlighted in any document.

Supported Browsers:

The HTML <i> tag, which represents italicized text, is supported by all major web browsers, including:

  • Google Chrome
  • Mozilla Firefox
  • Apple Safari
  • Microsoft Edge
  • Opera
  • Internet Explorer 


You can use the <i> tag to apply italic styling to text across various web browsers.

Frequently Asked Questions

What is the use of HTML i tag?

The HTML i tag is used to write any text in italics.

How can we write italic text in HTML?

To write italic text in HTML, enclose your text inside <i>(opening) and </i>(closing) tags.

Where can we use HTML i tag?

HTML i tag plays an important role while writing phrases, and thoughts. We can also use this tag while writing poetry and creative content.

Why is I tag used for icons?

The <i> tag is used for icons because it stands for "italics," indicating a way to style text. It's repurposed in web development to represent icons due to its visual similarity.

Conclusion

In this article, we have discussed about HTML <i> tag. We have seen its syntax and uses. We have also discussed how we can run HTML codes on our browsers. To learn more about HTML, you can check out our other articles:

We hope this article helped you in understanding about HTML i tag. You can read more such articles on our platform, Coding Ninjas Studio. You will find articles on almost every topic on our platform. Also, you can practice coding questions at Coding Ninjas to crack good product-based companies. For interview preparations, you can read the Interview Experiences of popular companies. 

Happy Coding!

Previous article
How to Create a Button in HTML?
Next article
Difference Between HTML and XML
Guided path
Free
gridgp-icon
Basics of javascript
10 chapters
68+ Problems
gp-badge
Earn badges and level up
Live masterclass