w3resource

HTML5: How to define smaller text?

Go to Exercise page

Solution:

HTML Code:

<!DOCTYPE html><!-- Define document type as HTML -->
<html><!-- Begin HTML document -->
<head><!-- Start of document header -->
<meta charset="utf-8"><!-- Define character encoding -->
<title>How to define smaller 
text</title><!-- Title of the HTML page -->
</head><!-- End of document header -->
<body><!-- Start of document body -->
<p>w3resource is a free, open-source 
tutorial.</p><!-- Paragraph with regular-sized text -->
<p><small>you will learn with HTML5 
tutorial of w3resource.</small></p><!-- Paragraph with smaller text using the <small> tag -->
</body><!-- End of document body -->
</html><!-- End of HTML document -->

Explanation:

  • This HTML code defines a webpage with two paragraphs.
  • The first paragraph contains regular-sized text.
  • The second paragraph contains smaller text, achieved using the <small> tag.
  • The <small> tag is used to render text in a smaller font size, typically used for disclaimers, copyright notices, or secondary information.
  • By enclosing text within the <small> tag, the text inside it will be displayed in a smaller font size compared to the surrounding text.

Live Demo:

See the Pen small-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
Yes Yes Yes Yes Yes

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.