w3resource

HTML5: How to define a part of text in an alternate voice or mood?

Go to Exercise page

Solution:

HTML Code:

<!DOCTYPE html><!-- Declaration specifying the document type -->
<html><!-- Opening tag for the root element of the HTML document -->
<head><!-- Opening tag for the document's header section -->
<meta charset="utf-8"><!-- Metadata tag specifying the character encoding of the document -->
<title>How to define a part of text in an alternate voice or mood</title><!-- Title of the HTML document -->
</head><!-- Closing tag for the document's header section -->
<body><!-- Opening tag for the document's body section -->
<p><!-- Opening tag for a paragraph element -->
<i>W3resource</i> is very informative and easy to learn tutorial for the beginners</p><!-- Italics tag applied to the text "W3resource" -->
</body><!-- Closing tag for the document's body section -->
</html><!-- Closing tag for the root element of the HTML document -->

Explanation:

  • This HTML code demonstrates how to define a part of text in an alternate voice or mood using the <i> (italic) element.
  • The <i> element is used to apply italics to the enclosed text, which typically represents text in a different tone or mood.
  • In this example, the text "W3resource" is wrapped in <i> tags to display it in italics.
  • The rest of the text remains unaffected and is displayed in the default font style.

Live Demo:

See the Pen i-answer by w3resource (@w3resource) on CodePen.


See the solution in the browser

Supported browser

Firefox logo Chrome logo Opera logo Safari logo Internet Explorer logo
YesYesYesYesYes

Go to Exercise page

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.



Follow us on Facebook and Twitter for latest update.