HTML <i> Element

Publish in HTML Tutorial el 24/05/2025 15:33

The HTML <i> element represents a range of text that is set off from the normal text for some reason. The content is typically displayed in italic type. While this element was often used simply to apply italic styling in the past, in HTML5 it has semantic meaning and should be used to represent text that is in an alternate voice or mood, or otherwise offset from the normal prose.


Common use cases for <i> include:

  • Technical terms
  • Foreign language phrases
  • Thoughts (like in narrative)
  • Ship names in Western texts
  • Book/movie/song titles (though <cite> may be more appropriate)


Basic Syntax

Here's how the basic <i> element looks in code:

And here's how it renders:

This is italicized text within a paragraph.


Examples of Usage

Example 1: Foreign Words

The <i> element is perfect for marking foreign words or phrases:

Play Code


Example 2: Technical Terms

Use <i> to highlight technical terms when they first appear:

Play Code


Example 3: Thoughts in Narrative

The <i> element can represent a character's thoughts in fiction:

Play Code


Example 4: Dynamic Italics with JavaScript

Here's how you can toggle italic styling with JavaScript:

Play Code


Example 5: Combining with Other Semantic Elements

This example shows how <i> can be combined with other semantic elements:

Play Code


Tips and Best Practices

  • Don't use <i> just for visual styling - use CSS for that purpose (font-style: italic).
  • Consider using the lang attribute when marking foreign words.
  • For emphasis, use <em> instead, as it carries semantic meaning for screen readers.
  • For book/movie titles, consider <cite> which is more semantically appropriate.
  • You can combine <i> with other semantic elements when appropriate.


Accessibility Considerations

Screen readers typically don't announce <i> elements differently unless they contain semantic information (like the lang attribute). If you're trying to convey emphasis, use <em> instead, as screen readers will change their tone when encountering emphasized text.

También te puede interesar

HTML <style> Element
HTML <style> Element

The <style> HTML element contains style information for a document, or part of a document. ...

HTML <strong> Element
HTML <strong> Element

The <strong> element is used to indicate that its content has strong importance, seriousnes...

HTML <span> Element
HTML <span> Element

The <span> element is an inline container used to mark up a part of a text or document. Unl...

HTML <source> Element
HTML <source> Element

The <source> element is used to specify multiple media resources for media elements like &l...

HTML <small> Element
HTML <small> Element

The <small> element is used to represent side-comments and small print, typically for discl...

HTML <section> Element
HTML <section> Element

HTML <section> Element: The Complete Guide The <section> element is a semantic HTML ...