Table of Contents
INTRODUCTION
The HTML <dfn> element is used to specify the term being defined within a sentence. It's a semantic element that helps browsers, search engines, and assistive technologies understand that the marked word is a definition. It is an inline element.
Display: By default, most browsers italicize the content of <dfn> to distinguish it visually.
Syntax:<dfn> - TEXT - </dfn>
Example:
<p><dfn>HTML</dfn> stands for HyperText Markup Language. It is the standard for creating web pages.
</p>
Output:
HTML stands for HyperText Markup Language. It is the standard for creating web pages.
Tag Omission
The HTML <dfn> element must have both start tag and end tag.
ATTRIBUTES
The <dfn> element has global attributes.
Title Attribute And dfn Tag
The title attribute has special meaning with dfn element. The term being defined follows some rules which as discussed below:
- If a <dfn> tag has a title attribute, the title’s value is treated as the term
being
defined. The tag still needs text inside it, which can be a shorter or abbreviated
version of the term.
<p> The term <dfn title="Cascading Style Sheets">CSS</dfn> refers to the language used to style HTML documents. </p>
- If a <dfn> tag only contains an <abbr> with its own title, and no other
text, then the
value of the abbr's title is treated as the term being defined.
<p> <dfn><abbr title="HyperText Markup Language">HTML<abbr></dfn> is the standard language used to create web pages. </p>
- If a dfn element has a title attribute, it should only contain the term being defined, with no additional text.
Frequently Asked Questions (FAQ)
Is it semantically correct to use multiple dfn and abbr tags within summary and details tags in HTML?
<details>
<summary>Click to learn more about HTML tags</summary>
<p><dfn><abbr title="HyperText Markup Language">HTML</abbr></dfn> is the standard language for creating web pages.
</p>
<p><dfn><abbr title="Cascading Style Sheets">CSS</abbr></dfn> is used to style the layout of web pages.
</p>
</details>