Inline
HTML 4.0
The inline quotation element represents a short quotation that doesn’t require paragraph breaks. Browsers automatically add quotation marks around the content.
Interactive code playground requires JavaScript. Here's the code:
<p>As Einstein said, <q>Imagination is more important than knowledge.</q></p>
Browsers automatically add appropriate quotation marks based on the language setting.
Attribute Description Example citeURL to the source of the quotation cite="https://example.com/source"
Interactive code playground requires JavaScript. Here's the code:
<p>He said, <q cite="https://example.com/speech">We shall overcome.</q></p>
Interactive code playground requires JavaScript. Here's the code:
<p>The professor said, <q>The exam will be postponed until next week.</q></p>
Interactive code playground requires JavaScript. Here's the code:
<p>She asked, <q>What time does the meeting start?</q></p>
<p>I replied, <q>It starts at 3 PM.</q></p>
Interactive code playground requires JavaScript. Here's the code:
<p>Mark Twain once wrote, <q>The secret of getting ahead is getting started.</q></p>
Interactive code playground requires JavaScript. Here's the code:
<p>According to the manual, <q>Always save your work before closing.</q></p>
The browser handles nested quotes correctly:
Interactive code playground requires JavaScript. Here's the code:
<p>John said, <q>Mary told me, <q>I'll be there at noon.</q></q></p>
<!-- Short inline quotations -->
< p > He said, < q > I'll be right back. </ q ></ p >
Use for quotes within running text.
<!-- Longer quotations -->
< p > This is a longer quotation that
spans multiple sentences or paragraphs. </ p >
Use for longer, block-level quotations.
Browsers add quotes automatically based on language:
Interactive code playground requires JavaScript. Here's the code:
<!-- English: "quotes" -->
<p lang="en">He said, <q>Hello!</q></p>
<!-- French: «guillemets» -->
<p lang="fr">Il a dit, <q>Bonjour!</q></p>
<!-- German: „Anführungszeichen" -->
<p lang="de">Er sagte, <q>Guten Tag!</q></p>
Combine with <cite> for source attribution:
Interactive code playground requires JavaScript. Here's the code:
<p>In <cite>To Kill a Mockingbird</cite>, Atticus says, <q>You never really understand a person until you consider things from his point of view.</q></p>
Customize the quotation appearance:
Interactive code playground requires JavaScript. Here's the code:
<style>
q {
quotes: '"' '"' ''' ''';
font-style: italic;
color: #555;
}
q::before {
content: open-quote;
font-weight: bold;
color: #0066cc;
}
q::after {
content: close-quote;
font-weight: bold;
color: #0066cc;
}
</style>
<p>She said, <q>This is a custom styled quote.</q></p>
Interactive code playground requires JavaScript. Here's the code:
<style>
.custom-quote {
quotes: '❝' '❞' '❛' '❜';
}
</style>
<p class="custom-quote">He remarked, <q>These are decorative quotes.</q></p>
Interactive code playground requires JavaScript. Here's the code:
<div class="testimonial">
<p><q>This product changed my life! Highly recommended.</q></p>
<footer>— Sarah Johnson, Customer</footer>
</div>
Interactive code playground requires JavaScript. Here's the code:
<article>
<p>The mayor announced, <q>We are committed to improving public transportation throughout the city.</q></p>
<p>When asked about the timeline, she added, <q>We expect to see changes within the next six months.</q></p>
</article>
Interactive code playground requires JavaScript. Here's the code:
<dl>
<dt>Interviewer:</dt>
<dd><q>What inspired you to start this company?</q></dd>
<dt>CEO:</dt>
<dd><q>I saw a gap in the market and wanted to fill it.</q></dd>
<dt>Interviewer:</dt>
<dd><q>What are your plans for the future?</q></dd>
</dl>
Interactive code playground requires JavaScript. Here's the code:
<div class="review">
<p>⭐⭐⭐⭐⭐</p>
<p>Reviewer says: <q>Excellent quality and fast shipping.</q></p>
<footer>Review from December 2024</footer>
</div>
<!-- Don't use <q> for emphasis -->
< p > This is < q > very important </ q > . </ p >
< p > This is < em > very important </ em > . </ p >
<!-- Browser adds quotes -->
< p > He said, < q > Hello! </ q ></ p >
Results in: He said, “Hello!”
<!-- Don't add quotes manually with <q> -->
< p > He said, " < q > Hello! </ q > " </ p >
Results in: He said, ""Hello!"" (double quotes!)
Screen readers may announce quotations with appropriate intonation, helping convey the quoted nature of the text.
When possible, include attribution:
< p >< q > Knowledge is power. </ q ></ p >
< p > As Francis Bacon said, < q > Knowledge is power. </ q ></ p >
The cite attribute provides machine-readable source information:
According to the article,
< q cite = " https://example.com/article " > climate change is accelerating </ q > .
Different languages use different quotation styles:
Interactive code playground requires JavaScript. Here's the code:
<style>
[lang="en"] q { quotes: '"' '"' ''' '''; }
[lang="fr"] q { quotes: '« ' ' »' '‹ ' ' ›'; }
[lang="de"] q { quotes: '„' '"' '‚' '''; }
</style>
<p lang="en">English: <q>Hello</q></p>
<p lang="fr">French: <q>Bonjour</q></p>
<p lang="de">German: <q>Guten Tag</q></p>
Browser Version Notes Chrome 1+ Full support Firefox 1+ Full support Safari 4+ Full support Edge 12+ Full support IE 8+ Full support
The <q> element has excellent browser support. Automatic quotation marks are supported in all modern browsers.