Design Converter
Education
Last updated on Feb 20, 2025
•4 mins read
Last updated on Feb 17, 2025
•4 mins read
How do you format long quotes in HTML?
When adding quoted text to a webpage, you want it to stand out clearly. That's where the <blockquote>
tag comes in. It helps structure long quotes, making them easy to read.
This blog explains what’s a block quote, how to use the cite attribute, and ways to style it with CSS. You’ll find examples and syntax details to format quotes the right way.
Let’s get started!
The blockquote element is an HTML element that is used to indicate a quotation that has been quoted from another source. This block-level element is different from inline quotations, which are typically enclosed in quotation marks.
By default, most browsers apply indentation to the blockquote to visually separate it from the main text. The indentation is commonly applied using the margin-left property in CSS.
A basic blockquote structure in HTML looks like this:
1<blockquote> 2 This is a block-level quotation. 3</blockquote>
This is a simple way to mark a quotation, but for better accessibility and credibility, it is recommended to use the cite attribute.
The cite attribute in the blockquote element specifies the URL or source of the quotation. While it does not change the appearance of the blockquote in most browsers, it helps in defining the context and improves accessibility for screen readers.
1<blockquote cite="https://example.com/quotes"> 2 HTML5 introduced new semantic elements to improve web development. 3</blockquote>
In the example above, the cite attribute specifies the URL from which the quotation was quoted from another source.
While the blockquote element is used for long quotations, inline quotations are handled with the <q>
tag. The <q>
tag is an inline element, which means it does not introduce block-level formatting. Instead, it simply wraps shorter quotes within quotation marks.
1<p>As Albert Einstein once said, <q>Imagination is more important than knowledge.</q></p>
In this example, the inline quotations are automatically wrapped with quotation marks by most browsers.
To improve the appearance of a blockquote, custom CSS can be applied. Most browsers apply default styling, but it can be modified using properties like font style, margin-left, and indentation.
1blockquote { 2 font-style: italic; 3 color: #555; 4 border-left: 4px solid #ccc; 5 margin-left: 20px; 6 padding-left: 15px; 7}
This CSS makes the blockquote visually distinct by applying an italic font style, a border, and additional space on the left.
Sometimes, displaying the source of the quotation as a reference below the blockquote is preferred. This can be done using the <cite>
tag within the blockquote.
1<blockquote> 2 The journey of a thousand miles begins with one step. 3 <cite>- Lao Tzu</cite> 4</blockquote>
In this example, the cite tag is used to attribute the quoted text to Lao Tzu.
• Define the purpose of the blockquote clearly.
• Always use the cite attribute when possible for credibility.
• Ensure the quoted text is accurate and quoted from another source.
• Apply CSS to improve readability and differentiate it from the main text.
• Use inline quotations for shorter quotes and the blockquote element for longer passages.
• Consider accessibility by ensuring screen readers can interpret the quotation correctly.
• Not using the cite attribute – Always include the source of the quotation when possible.
• Overusing blockquotes – Use them only when necessary to avoid clutter.
• Misusing quotation marks – Ensure proper formatting when using inline quotations.
• Ignoring CSS styling – Default browser styling may not always be visually clear.
The HTML Block Quotes feature is an important tool for formatting quoted text in a structured and visually distinct manner. The blockquote element improves readability, provides semantic meaning, and ensures proper indentation in the document. By using the cite attribute, the source of the quotation can be referenced for credibility. Applying CSS customization enhances the design, making blockquotes more effective in conveying quotations.
When using HTML, always follow best practices to ensure that the block-level element is correctly implemented, accessible to screen readers, and properly formatted within the surrounding text.
Tired of manually designing screens, coding on weekends, and technical debt? Let DhiWise handle it for you!
You can build an e-commerce store, healthcare app, portfolio, blogging website, social media or admin panel right away. Use our library of 40+ pre-built free templates to create your first application using DhiWise.