w3resource

HTML5: How to define a short quotation?

Go to Exercise page

Solution:

HTML Code:

<!DOCTYPE html><!-- Define document type as HTML5 -->
<html><!-- Start of HTML document -->
<head><!-- Start of head section -->
<meta charset="utf-8"><!-- Define character encoding -->
<title>How to define a short quotation</title><!-- Title of the document -->
</head><!-- End of head section -->
<body><!-- Start of body section -->
<p>Einstein said <q>Truth is what 
stands the test of 
experience.</q></p><!-- Define a paragraph with a short quotation -->
</body><!-- End of body section -->
</html><!-- End of HTML document -->


Explanation:

  • This HTML code demonstrates how to define a short quotation using the <q> element.
  • Inside a <p> (paragraph) element, a short quotation by Einstein is included using the <q> element.
  • The text "Einstein said" before the <q> element provides attribution to the speaker of the quotation.
  • The <q> element is used to define inline, short quotations, typically within a paragraph of text.
  • Quotations defined with the <q> element are typically enclosed in double quotation marks and are automatically formatted with quotation marks by web browsers.

Live Demo:

See the Pen q-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.



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://w3resource.com/html-css-exercise/basic/q-answer.php