Introduction
The <q>
element in HTML is used to define a short inline quotation. Browsers usually render this element with quotation marks surrounding the quoted text.
Here’s an example of how you might use it:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<p>The philosopher Socrates once said: <q>An unexamined life is not worth living.</q></p>
</body>
</html>
Output :
In this example, the text “An unexamined life is not worth living.” is quoted inline within the paragraph, and the <q>
element is used to denote that it’s a quotation. Depending on the browser’s default styling, it may display with quotation marks around the quoted text.