Skip to content

HTML <dfn> Tag

The <dfn> tag is used to define the term that is specified in the context of a definition phrase or sentence. In the browser, the content of the tag is shown in italic.

The <p> tag, the <dt>/<dd> pair, or the <section> tag act as the definition context for the term.

The defined term is identified with the following rules:

  • If <dfn> has a title attribute, the value of this attribute is considered to be the term being defined. The text within the element can be an abbreviation (probably using <abbr>).
  • If <dfn> has only one child element which is an <abbr> element with a title attribute, and the <dfn> element doesn’t have its text content, then the precise value of the title of <abbr> will be the term being defined.
  • If this is not the case, the text content of <dfn> is the term which is being defined.

If an id attribute is included on the <dfn> element, then you can link to this element with <a> elements. Such links help the reader to quickly navigate to the definition of the term by clicking on the link.

Syntax

The <dfn> tag comes in pairs. The content is written between the opening (<dfn>) and closing (</dfn>) tags.

Example of the HTML <dfn> tag:

The HTML definition|Example of the HTML <dfn> tag>|W3Docs

html
<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
  </head>
  <body>
    <p><dfn>HTML</dfn> (HyperText Markup Language ) — The standardized markup language for documents on the World Wide Web. Most web pages contain a description of the markup in the language HTML</p>
  </body>
</html>

Result

dfn example

In the following example, the value of the title attribute is considered to be the term being defined.

Example of the HTML <dfn> tag with a title attribute:

Mouse over to see the definition|Example of the HTML <dfn> tag|W3Docs

html
<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
  </head>
  <body>
    <p>Mouse over to see the definition.</p>
    <dfn title="HyperText Markup Language">HTML</dfn>
  </body>
</html>

Result

Example of the HTML <dfn> tag with the HTML <abbr> tag:

Example of the HTML <dfn> tag with the <abbr> tag:

html
<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
  </head>
  <body>
    <p>Mouse over to see the definition.</p>
    <dfn><abbr title="Cascading Style Sheets">CSS</abbr></dfn>
  </body>
</html>

Attributes

AttributeValueDescription
titleSpecifies the definition of a term (shown when hovering).

The <dfn> tag also supports the Global Attributes and the Event Attributes.

How to style an HTML <dfn> tag

css
dfn {
  color: #0056b3;
  font-weight: bold;
}

Practice

What is the correct usage and function of the HTML <dfn> tag according to the content found on the W3Docs website?

Dual-run preview — compare with live Symfony routes.