HTML Q Tag

In HTML, the <q> tag stands for Inline quotation.

  • The content enclosed inside <q> tag represents a short inline quotation.

  • In Modern Browsers, it is implemented using quotation marks surrounding the text.

  • For short quotations where there is no need for paragraph breaks, it is recommended to use <q> tag while for long quotations <blockquote> tag is used.

  • Also, this is an Inline Element.

HTML <q> Tag Syntax and Usage

The <q> tag requires both opening (start) tag and closing(end) tag.

Required syntax for the same is given below:

<q>
....content here!
</q>

HTML <q> Tag Basic Example

Below we have a basic example for a clear understanding of <q> tag:

HTML <q> tag Attributes

<q> tag supports both global and event attributes.

Other Attributes of <q> Tag

cite attribute is the most commonly used attribute of <q> tag and hence the description for the same is given below:-

  • The value of the cite attribute is in the form of a URL that designates a source document or a message for the quoted information.
  • This attribute points to the reference for the quote.

Example of cite attribute

<!DOCTYPE html> 
<html>  
    <head>  
        <title>HTML q cite Attribute</title>  
    </head>  
      
    <body style="text-align:center;">  
          
        <h1>Studytonight</h1> 
          
        <h2> 
            HTML <q>cite Attribute  
        </h2> 
          
        <p> 
            <q cite="https://www.studytonight.com/"> 
                StudyTonight 
            </q>  
            Best Place to Learn coding online 
        </p>  
    </body>  
</html>    

Default CSS Settings of HTML <q> Tag

q {
  display: inline;
}

q:before {
  content: open-quote;
}

q:after {
  content: close-quote;
}

Browser Support for HTML <q> Tag

Following browsers support this attribute:

  • Firefox 1+

  • Google Chrome 1+

  • Internet Explorer 4+

  • Apple Safari 1+

  • Opera 4+