Open In App

HTML dfn Tag

Last Updated : 27 Nov, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

The <dfn> tag in HTML represents a definition element and is used to represent a defining instance in HTML. Generally, the defining instance is the first use of a term in a document. The <dfn> tag requires a starting as well as an ending tag.

HTML
<!DOCTYPE html>
<html>

<body>
    <p>
        <dfn>Geeksforgeeks</dfn>
        is a portal for geeks.
    </p>
</body>

</html>

Syntax

<dfn> Content ...</dfn>

The content inside the <dfn> tag can be any of the following:

Term Definition Inside <dfn>: Placing the term's meaning directly within the <dfn> element.

<p><dfn>Learn</dfn>HTML from GeeksforGeeks</p>

Enhanced Information with Title Attribute

Utilizing the title attribute to provide supplementary details about the term.

<p><dfn title="HyperText Markup Language">Learn</dfn>HTML from GeeksforGeeks</p>
HTML
<!DOCTYPE html>
<html>

<body>
  <h1>Understanding Web Tech</h1>
  <p>
    The <dfn title="HyperText Markup Language">HTML</dfn>
    is the standard markup language for creating web pages.
  </p>
  <p>In web development, <dfn title="Cascading Style Sheets">CSS</dfn>
    is used to style HTML elements.
  </p>
  <p>
    <dfn>JavaScript</dfn>
    is a programming language that enables interactive web pages.
  </p>
</body>

</html>

Use of <abbr> for Term Explanation

Employing the <abbr> tag within <dfn> to abbreviate or clarify terms.

<p>
<dfn><abbr title="HyperText Markup Language">
Learn</abbr>
</dfn>HTML from GeeksforGeeks
</p>
HTML
<!DOCTYPE html>
<html>

<body>
  <h1>Understanding Web Tech</h1>
  <p>
    The <dfn><abbr title="HyperText Markup Language">HTML</abbr></dfn>
    is the standard markup language for creating web
    pages.
  </p>
  <p>In web development, <dfn><abbr title="Cascading Style Sheets">CSS</abbr></dfn>
    is used to style HTML elements.
  </p>
  <p><dfn><abbr title="JavaScript">JS</abbr></dfn>
    is a programming language that enables interactive web pages.
  </p>

</body>

</html>

Identification with id Attribute

Adding an identifier (id) to the term's definition for easy reference.

<p><dfn id="html-def">Learn</dfn>HTML from GeeksforGeeks</p>
<p>Hey Their,How are you</p>
<p>Learn <a href="#html-def">HTML</a>on Geeks platform</p>
HTML
<!DOCTYPE html>
<html>

<body>
  <p>
    <dfn id="Geeksforgeeks">GFG</dfn>
    is a portal for geeks.
  </p>
  <p>
    Practice questions for cracking
    technical interviews.
  </p>
  <p>
    Prepare for GATE CSE – 2019
  </p>
  <p>Visit
    <a href="#Geeksforgeeks">GFG</a>.
  </p>
</body>

</html>

Next Article

Similar Reads