/

HTML / CSS / JavaScript Tutorial

HTML Element: <i>

[this page | pdf | back links]

The HTML <i> element indicates a part of text in an alternate voice or mood. Typically it is rendered as italicised text. Convention recommends using the <i> element only when there isn’t a more appropriate element, such as <cite>, <dfn>, <em>, <mark> or <strong>.

 

The attributes it can take are HTML global attributes and HTML event attributes.

 

To create or access such an element in JavaScript see here. The corresponding HTML DOM object supports standard DOM properties and methods. The default style applicable to this element is shown here.

 

EXAMPLE:


HTML USED IN THIS EXAMPLE:
<!DOCTYPE html>
<html> <!-- Copyright (c) Nematrian Limited 2018 -->
<head></head>
<body>
Created using HTML:<br>
<i>alternative text</i>

<br><br>Created using JavaScript:<br>
<span id="element"></span>

<script>
var x = document.createElement("I");
x.textContent = "alternative text";
// or use var txt = document.createTextNode("alternative text");
// x.appendChild(txt);
document.getElementById("element").appendChild(x);
</script>

</body>
</html>


NAVIGATION LINKS
Contents | Prev | Next | HTML Elements


Desktop view | Switch to Mobile