Create HTML <q> and <blockquote> Elements Online
The HTML Quote Generator creates either a <q> element for a short quotation within a sentence or a <blockquote> element for an extended quotation presented as a separate block. Both elements can carry a cite attribute containing a source URL.
In blockquote mode, the generator places the quotation in a paragraph and can add a visible attribution with <figcaption>. The
HTML Standard
permits grouping a block quotation and its attribution in a <figure>.
HTML Quote Generator Options
- Type selects an inline
qelement or a block-levelblockquoteelement. - Caption adds visible attribution below a block quotation. It is used only in blockquote mode.
- Text sets the quotation content.
- Cite sets the source URL in the element’s
citeattribute; it does not create a visible source link.
Characters with special meaning in HTML are escaped before the preview and generated markup are updated. The generated C# code uses the same selected type, quotation text, source URL, and optional caption.
Create HTML <q> and <blockquote> Elements in C#
The C# panel shows how to create the configured quotation with Aspose.HTML for .NET . The generated code follows this workflow:
- Create an
HTMLDocument. - Create an
HTMLQuoteElementfor the selectedqorblockquotetag withCreateElement(). - Assign the optional source URL through
Citeand add the entered text. - In blockquote mode, create the surrounding
figure, paragraph, and optionalfigcaption, then connect them withAppendChild(). - Add the result to the document and write
quotation.htmlwithSave().
Choose the quotation type and enter its content before copying the updated C# code.
HTML Quote and Blockquote Generator FAQ
1. When should I use <q> instead of <blockquote>?
Use <q> for a short quotation that remains within a sentence or paragraph. Use <blockquote> for an extended quotation that forms a separate block and may contain paragraphs or other flow content.
2. Does the cite attribute display the quotation source?
No. The cite attribute stores a source URL as metadata, but browsers do not normally display it. Add visible attribution or a source link in the surrounding content when readers need to see the source.
3. Why does <blockquote> mode use <figure> and <figcaption>?
A <figure> can group a self-contained quotation with its visible attribution. The <blockquote> holds the quoted content, while <figcaption> identifies its source or author without placing attribution inside the quotation itself.
4. Should I type quotation marks inside a <q> element?
Usually not. User agents add language-appropriate quotation marks around <q> content. Hard-coded marks can produce duplicated punctuation and may not adapt correctly when the document language changes.
5. Is the cite attribute the same as the <cite> element?
No. The cite attribute supplies a source URL for <q> or <blockquote>. The
<cite> element
identifies the title of a cited creative work in visible document content.
Get Started with Aspose.HTML for .NET API
Install Aspose.HTML for .NET from NuGet with the .NET CLI:
dotnet add package Aspose.HTML
You can also use the NuGet Package Manager UI or run Install-Package Aspose.HTML in the Package Manager Console. See the
installation guide
for setup details, or request a
temporary license
to evaluate the API without evaluation limitations.
Other Supported HTML Generators
Create and preview markup for other common HTML elements.