HTML Quoted Text Block

HTMLBeginner
Practice Now

Introduction

In HTML, we use the <blockquote> tag to display quotations on a webpage with the author's name or source. The tag is used as a block-level element and is displayed as a separate paragraph. In this lab, you'll learn how to create a blockquote using HTML <blockquote> tag.

Note: You can practice coding in index.html and learn How to Write HTML in Visual Studio Code. Please click on 'Go Live' in the bottom right corner to run the web service on port 8080. Then, you can refresh the Web 8080 Tab to preview the web page.

This is a Guided Lab, which provides step-by-step instructions to help you learn and practice. Follow the instructions carefully to complete each step and gain hands-on experience. Historical data shows that this is a beginner level lab with a 100% completion rate. It has received a 100% positive review rate from learners.

Add the HTML structure

Create an HTML file named index.html and open it in a code editor.

Add the HTML structure as shown below:

<!doctype html>
<html>
  <head>
    <title>HTML Blockquote Tag</title>
  </head>
  <body>
    <h1>HTML Blockquote Tag</h1>

    <!-- Add the blockquote -->
  </body>
</html>

Add the Blockquote Tag

Add the blockquote tag to your HTML code using the following syntax:

<blockquote>
  Your quote comes here...
  <cite>- Author Name</cite>
</blockquote>

Note: The cite tag is added inside the blockquote tag to provide the name of the author or the source of the quotation.

Add CSS Styling

Add CSS styling to the blockquote tag using the following code snippet:

<style>
  blockquote {
    display: block;
    margin-top: 1em;
    margin-bottom: 1em;
    margin-left: 40px;
    margin-right: 40px;
    font-style: italic;
    color: #555;
    padding: 5px 20px;
    border-left: 5px solid #ccc;
  }
</style>

Note: This code sets some basic styling to the blockquote tag. The border-left property adds a left border to the blockquote tag.

Add the quote you want to display in the web page replacing Your quote comes here....

Save the HTML file and open it in a web browser to see the blockquote displayed on the webpage.

Summary

In this lab, you learned about the <blockquote> tag to display a quote in a separate block on a web page. You also learned about the attributes that can be used with the tag and how to style it using CSS. With the blockquote tag, you can display quotes on your web page with ease!