HTML5: How to define a short quotation?
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
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