The HTML tag <q>
is used to indicate a short quotation or a piece of text that is being quoted from another source. The <q>
tag is used to enclose the quoted text and is usually displayed in quotation marks. The <q>
tag is a semantic tag, which means that it provides information about the meaning of the text it encloses.
The <q>
tag is often used in conjunction with the <cite>
tag, which is used to indicate the source of the quotation. The <cite>
tag is used to enclose the name of the author or the title of the work from which the quotation is taken.
Here are some examples of how the <q>
tag can be used:
The following code displays a simple quotation:
<p>The quick brown fox
jumped over the lazy dog.</p>
The output of the above code will be:
The quick brown fox
jumped over the lazy dog.
The following code displays a quotation with a source:
<p>According to Albert Einstein, Imagination is more important than knowledge.
</p>
The output of the above code will be:
According to Albert Einstein, Imagination is more important than knowledge.
The <q>
tag can be nested to indicate multiple levels of quotations. The following code displays a nested quotation:
<p>According to William Shakespeare, to be or not to be, that is the question.<q> Whether 'tis nobler in the mind to suffer the slings and arrows of outrageous fortune, or to take arms against a sea of troubles, and by opposing end them?</q></q></p>
The output of the above code will be:
According to William Shakespeare, to be or not to be, that is the question.
Whether 'tis nobler in the mind to suffer the slings and arrows of outrageous fortune, or to take arms against a sea of troubles, and by opposing end them?
The <q>
tag is a useful tag for indicating quotations in HTML documents. It is a semantic tag that provides information about the meaning of the text it encloses. The <q>
tag can be used in conjunction with the <cite>
tag to indicate the source of the quotation.