<dfn> Tag in HTML
The <dfn> tag in HTML is used to define a term within a document. Typically, the first occurrence of a term that needs an explanation or definition is wrapped in the <dfn> tag. This tag is especially useful for definitions in glossaries or technical documents, as it helps browsers and screen readers emphasize and interpret the term correctly.
Key Points on <dfn> Tag:
- The <dfn> tag generally marks the first occurrence of a term or concept being defined.
- Browsers may apply italic styling by default, although it can be styled differently using CSS.
- It often pairs with the <abbr> or <code> tags for technical and scientific documentation.
- The title attribute can be used to provide additional context or a tooltip on hover.
Syntax of <dfn> Tag:
Syntax Example
<p>The term <dfn>HTML</dfn> stands for HyperText Markup Language.</p>
Example of <dfn> Tag in HTML:
This example demonstrates the use of the <dfn> tag to define the term “HTML” within a sentence.
Code Example
<p>The term <dfn title="HyperText Markup Language">HTML</dfn> is commonly used in web development.</p>
Output
The term HTML is commonly used in web development.
The <dfn> tag is ideal for emphasizing technical or specific terms in a document, making it easier for readers to identify definitions. The title attribute further clarifies the term's meaning on hover, enhancing the user experience.