Horje
HTML <q> Tag

The <q> HTML element indicates that the enclosed text is a short inline quotation. Most modern browsers implement this by surrounding the text in quotation marks. This element is intended for short quotations that don't require paragraph breaks; for long quotations use the <blockquote> element.

Definition and Usage

The <q> tag defines a short quotation.

Browsers normally insert quotation marks around the quotation.

Tip: Use <blockquote> for long quotations. 

Browser Support

Attributes

Attribute Value Description
cite URL Specifies the source URL of the quote

Global Attributes

The <q> tag also supports the Global Attributes in HTML.


Event Attributes

The <q> tag also supports the Event Attributes in HTML.


How to create HTML <q> Tag

It marks up a short quotation.

index.html
Example: HTML
<p>WWF's goal is to: 
<q>Build a future where people live in harmony with nature.</q>
We hope they succeed.</p>

Output should be:

How to create HTML <q> Tag

How to Use CSS to style the <q> element

See the Example.

index.html
Example: HTML
<!DOCTYPE html>
<html>
<head>
<style>
q {
  color: gray;
  font-style: italic;
}
</style>
</head>
<body>

<h1>The q element + CSS</h1>

<p>WWF's goal is to: 
<q>Build a future where people live in harmony with nature.</q>
We hope they succeed.</p>

</body>
</html>

Output should be:

How to Use CSS to style the <q> element

How to set Default CSS Settings on HTML <q> Tag

Most browsers will display the <q> element with the following default values.

index.html
Example: HTML
<style>
q {
  display: inline;
}
 
q:before {
  content: open-quote;
}
 
q:after {
  content: close-quote;
}
</style>

Output should be:

How to set Default CSS Settings on HTML <q> Tag

What is HTML <q> cite Attribute

Definition and Usage

The cite attribute specifies the source URL of a quote.

Browser Support

Note: The cite attribute has no visual effect in ordinary web browsers, but can be used by screen readers.


Syntax

<q cite="URL">

Attribute Values

Value Description
URL Specifies the source URL of the quote.

Possible values:

  • An absolute URL - points to another web site (like href="http://www.example.com/page.htm")
  • A relative URL - points to a file within a web site (like href="page.htm")

How to add HTML <q> cite Attribute

It specify the source URL of a quote.

index.html
Example: HTML
<p>WWF's goal is to:
<q cite="http://www.wwf.org">
Build a future where people live in harmony with nature.</q>
We hope they succeed.
</p> 

Output should be:

How to add HTML <q> cite Attribute




html q tag

Type:
Develop
Category:
Web Tutorial
Sub Category:
HTML Tag
Uploaded by:
Admin


Read Article
https://develop.horje.com/learn/1434/reference