Quotations and Comments in HTML

Ekansh Saxena
Last Updated: May 13, 2022

Introduction

What does HTML mean, and how is it related to the web? In other words, what role does HTML play in web development?

HTML stands for HyperText Markup Language. First comes hypertext. It contains links to other texts, and that's the entire web. One document points to another document. It’s not just about the text; hypermedia is playing a massive role in the web. You can watch videos, listen to music. The next comes Markup, which means to mark something up. For example, if you have some content like a writing document, Why I Love This Article. That is the content, and if you annotate the content to the browser or some other program present, you will need HTML to do it. 

Quotations and Comments in HTML 

At a depth of HTML is the HTML tag. So it's quite important to understand what an HTML tag consists of and how to code up an HTML tag properly. Today we will study Quotations and Comments in HTML. 

<Quotation> tag in HTML

Let’s first begin with Quotations in HTML:

The <q> tag or the quotation tag indicates that the enclosed text is a short inline quotation. 

It has a start tag as <q> and an end tag as </q>

We often use Quotations in our writings. We can understand this with the help of an example. 

 

Input:

<!DOCTYPE html>
<html lang="en" >


<body>

      <p>Browser usually insert quotation mark around q element </p>

       <p>WWF's goal is to: <q>Build a future </q></p>                                                                            

      <p

 </body>
</html>

 

Output: 

Browsers usually insert quotation marks around the q element

WWF's goal is to: “Build a future”

Now you might be wondering what to use for long quotations. We got you covered. We use the <blockquote> tag for the same. 

The <blockquote> tag

This tag is used to quote something from other sources. One advantage of this tag is that the browser identifies this tag and intends it accordingly. 

We can see the following example to see the above tag. 

Input:

<!DOCTYPE html>
<html lang="en" >
<body>
  <p>Browser indent blockquote element </p>

   <blockquote> here is the text for blockquote </blockquote> 
</body>
</html>

Output: 

Browser indent blockquote element 

    here is the text for blockquote

 

Comments in HTML

This tag is generally used to comment on your code so that the person reading the code can easily understand it. One advantage of this tag is that it is not visible in the browser. It is worthwhile to note that the comment tag does not have any end tag. 

We can look at the following example for the comment tag. 

 

Input:

<!DOCTYPE html>
<html lang="en" >


<body>

   <!-- This is a comment -->
  <p>This is a demo text </p>
</body>
</html>

Output: 

This is a demo text

 

FAQs

What are semantic tags and their significance? 

Well, a semantic HTML element is an element that implies some meaning to the content. In other words, it's an element that tells you something about the content, whether its importance, whether a bit of its description, it gives hints. Now the reason it's important is that we humans and machines can understand the meaning of that content surrounded by a semantic tag much better than if we just cover it with some tag that doesn't tell us anything other than this is some sort of a division within the document. 

 

For what purpose the <cite> attribute is used?

<cite> attribute is used to specify the source of the quote. 

Note that the <cite> quote has no effect on the browser, but screen readers can use it. You can read more about this here.

 

Key Takeaways

In this article, we have understood the basics of HTML and its role in web development and studied the quotations and comments in HTML. We have also learned the cite attribute that is used in the comment tag. There are a lot more tags in HTML. 

You can refer to the tag sheet here.


You can also refer to the courses on web development on our platform. 

Was this article helpful ?
2 upvotes

Comments

No comments yet

Be the first to share what you think