<dfn>

Definition

The <dfn> element is a component of HTML that allows for the definition of terms within a web page. This element is often used in conjunction with the <abbr> and <acronym> elements, providing a clear and concise explanation of complex vocabulary.

By using the <dfn> element, web developers can ensure that their content is accessible and understandable to all users, regardless of their level of knowledge or expertise. This element can also be useful for search engines, as it helps to improve the searchability and relevancy of web pages.

Furthermore, the <dfn> element can be customized with CSS styles, allowing for further control over its appearance and formatting. This element is typically paired with the "title" attribute, which provides additional context and explanation for the defined term.

Examples

<dfn title="A standardized system for tagging text files to achieve font, color, and layout effects">HTML</dfn>

In the following example, the <dfn> element is given the "custom-style" class, which is defined in the CSS stylesheet. This class applies bold and blue formatting to the term "HTML" on the web page, making it stand out and providing additional context and explanation for the defined term

<style>
	.custom-style {
		font-weight: bold;
		color: blue;
	}
</style>

<p>The <dfn title="A standardized system for tagging text files to achieve font, color, and layout effects" class="custom-style">HTML</dfn> language is used to structure and format web pages.</p>

Attributes

AttributeDescriptionDeprecated
titleProvides additional context and explanation for the defined termNo

Best Practices

  • Use the <dfn> element to mark the defining instance of a term.
  • Place the <dfn> element within the context in which the term is being defined.
  • Use the title attribute to provide a brief, human-readable explanation of the term being defined.
  • Use the <dfn> element only for defining a term, not for providing additional information or context about the term.
  • Avoid using the <dfn> element for words or phrases that are not technical terms or that are not being defined in the current context.

Accessibility Considerations

The <dfn> element is used to mark the defining instance of a term in an HTML document. In order to make the content within a <dfn> element accessible, you should make sure to provide additional context and information about the term being defined. This can be done by placing the <dfn> element within a surrounding <p> or <div> element, and providing a brief explanation or definition of the term within that container.

Additionally, you should make sure to use the title attribute to provide a more detailed explanation of the term being defined. This attribute can be used to provide a full definition of the term, or to provide additional context or usage information. This attribute will be displayed as a tooltip when the user hovers over the <dfn> element, allowing users to quickly access the additional information without having to leave the page.

Browser Compatibility

ChromeFirefoxSafariInternet ExplorerMicrosoft EdgeOpera
YesYesYesYesYesYes