HTML5: How to emphasize text in an HTML document?
Solution:
HTML Code:
<!DOCTYPE html><!-- Document type declaration for HTML5 -->
<html><!-- Start of HTML document -->
<head><!-- Start of head section -->
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><!-- Metadata for specifying character encoding -->
<title>emphasized text example</title><!-- Title of the HTML document -->
</head><!-- End of head section -->
<body><!-- Start of body section -->
<h1>w3resource Tutorial</h1><!-- Heading level 1 -->
<strong><!-- Strong emphasis -->
<em>HTML CSS Exercise</em><!-- Emphasized text -->
</strong><!-- End of strong emphasis -->
</body><!-- End of body section -->
</html><!-- End of HTML document -->
Explanation:
- The document starts with the doctype declaration specifying that it is an HTML5 document.
- Inside the <html> tags, the HTML document structure begins.
- The <head> section contains metadata about the document, including the character encoding specified using the meta tag.
- The <title> element sets the title of the HTML document.
- The <body> section is where the visible content of the webpage resides.
- <h1> represents a top-level heading.
- <strong> indicates strong emphasis on its contents.
- <em> represents emphasized text within the strong emphasis.
- The HTML document ends with the closing </html> tag.
Live Demo:
See the Pen em-answer by w3resource (@w3resource) on CodePen.
See the solution in the browser
Supported browser
Yes | Yes | Yes | Yes | Yes |
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics