- Home
- /
- Tutorials
- /
- HTML Tutorial
- /
- HTML <q> Tag
HTML Tags
HTML <q> Tag
The q tag marks a short quote inside a sentence, and the browser adds the quotation marks for you, in the right style for the page's language. For a long quote on its own, use blockquote instead.
Quotes that need their own paragraph go in the blockquote tag. The title of the work a quote comes from goes in the cite tag.
Syntax
html
<q cite="source-url">Short quoted text</q>| Attribute | What it does |
|---|---|
| cite | The web address of the source. It is not shown on the page. |
Global attributes such as class, id and lang also work.
Example
html
<!DOCTYPE html>
<html>
<head>
<title>Q Tag Example</title>
<style>
.inline-quote {
color: #2c3e50;
font-style: italic;
}
</style>
</head>
<body>
<h1>HTML <q> Tag Example</h1>
<p>
Albert Einstein once said: <q class="inline-quote" cite="https://www.example.com" title="Einstein Quote">Imagination is more important than knowledge.</q>
</p>
</body>
</html>The quote appears inside quotation marks that the browser added. The cite and title values are not visible, though the title shows as a tooltip on hover.
Good to know
- Do not type quotation marks yourself inside
<q>, or readers see them twice. - The marks follow the page's
lang: English pages get “ ”, French pages « », German pages „ “. - Change them with CSS if needed:
q { quotes: "‘" "’"; }. - The
citeattribute is invisible. If the source matters, name it in the text too.
Browser Support
Chrome | Edge | Firefox | Safari | Opera | IE9+ |
|---|---|---|---|---|---|
| Yes | Yes | Yes | Yes | Yes | Yes |
HTML <q> Tag exercises
Quote in a sentence
Write this paragraph. The words markup is meaning are a quotation, and the browser should add the quotation marks: She said markup is meaning and left.
Result
Check your answer to see it here.
