HTML Quotations
HTML Quotations
HTML quotations allow you to include and format quoted text within your web content. HTML provides tags such as <blockquote> , <q> , <cite> , <address> , <bdo> , and <abbr> to structure and style quotes.
These quotation tags help maintain proper formatting and semantics, enhancing the presentation and meaning of quoted content on web pages. Incorporating quotes is essential for conveying information accurately and providing a well-organized reading experience for users.
HTML Quotation Elements
The following are the quotation elements that are used to insert and display quotations on the webpage:
| Tag | Description |
|---|---|
<q> | Defines a short inline quotation. |
<blockquote> | Defines a block-level indented quotation. |
<cite> | Specifies a reference to the title of a creative work, such as books or articles. |
<address> | Defines contact information. |
<bdo> | Overrides text direction. |
<abbr> | Defines an abbreviation or acronym. |
Short Quotation (<q>)
The <q> tag is used to define short (or inline) quotation marks in HTML, and the browsers often add quotation marks around it.
Syntax
The syntax to define a short quotation is:
<q>The content to be quoted</q>Example
Following is an example of displaying a short (or inline) quotation on the webpage:
Example
In the example below, we used the <q> tag on a particular text inside the <h1> tag:
Block-level Quotation (<blockquote>)
The <blockquote> tag is to indicate long quotations. It should contain only block-level elements within it and not just plain text. It specifies a section quoted from another source and contains only block-level elements.
We can also use the cite attribute inside the <blockquote> tag to indicate the source of the quotation in URL form.
Syntax
The syntax to define a block-level quotation is:
<blockquote>The multiple line content to be quoted </blockquote>Example
Following is an example of displaying a block-level quotation on the webpage:
Example
Folloiwng is an example of using the βciteβ attribute with the <blockquote> tag:
Styling Quotation (<blockquote>)
You can style the <blockquote> tag using the CSS to give it a better look as per your webpage theme.
In the following example, we are setting some CSS properties such as background color, border, border width, and font color to make it more attractive:
Cite a Quote (<cite>)
The <cite> tag is used to reference the title of a creative work, such as a book, movie, or song, within the content. It provides semantic meaning to the citation.
Example
Hereβs a coding example β
In this example, β<cite>β is used to indicate the title of the referenced book.
Contact Information (<address>)
The <address> tag is used to define the contact information for the author or owner of a document. It often includes details such as an email address, physical address, or other relevant contact information.
Example
Hereβs an example β
In this example, the β<address>β tag is used to provide contact information, including an email link and a physical address.
Bi-Directional Override (<bdo>)
The <bdo> tag in HTML, bdo stands for Bi-Directional Override, is used to override the current text direction. It is commonly used in situations where the default text direction needs to be changed, such as for displaying text from right to left.
Example
Hereβs an example β
In this example, the text within the β<bdo>β tag is displayed from right to left, overriding the default left-to-right direction.
Abbreviations (<abbr>)
The <abbr> tag is used to define abbreviations or acronyms, i.e., you can define an optional title for full form to a specific word or sentence.
Example
Hereβs an example β
In this example, <abbr> is used to abbreviate βWorld Wide Webβ to βWWW,β and the β title β attribute provides the full description of the abbreviation.