HTML <q> tag
The <q> tag is used to define a short quotation in a block of texts.
By default, web-browser adds quotation mark(" ") around the quote.
Type: Inline Element
Syntax of <q> tag
<q>Block of text</q>
Full code example
<!DOCTYPE html> <html> <head> </head> <body> According to the encyclopedia, <q> The Earth revolves around the Sun. </q> </body> </html>
Output on the browser
According to the encyclopedia,
"The Earth revolves around the Sun."
Supported Browsers
| Tag | Chrome | Internet Explorer | Firefox | Safari | Opera Mini |
|---|---|---|---|---|---|
| <q> | Yes | Yes | Yes | Yes | Yes |
Attribute of <q> tag
| Attribute | Value | Note |
|---|---|---|
| cite | URL | It specifies the URL of the quote. |
Example of using <q> tag with cite attribute
<q cite="https://website.com/page"> Quotes here </q>
More reference
The <q> tag is used only for a short sentence or a block of texts within a sentence. To define quotes having multiple sentences, use <blockquote> tag
Default CSS properties of <q> tag
q { display: inline; } q:before { content: open-quote; } q:after { content: close-quote; }
