Open In App

HTML <dfn> Tag

Last Updated : 20 Dec, 2023
Improve
Improve
Like Article
Like
Save
Share
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.

Syntax

<dfn> Content ...</dfn>

Note: The <dfn> tag supports the Global Attributes & Event Attributes in HTML.

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>
  • 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>
  • 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>
  • Cross-Reference with <a> Tags: Employing <a> tags to link terms to their definitions, aiding in navigation between terms and their explanations.

Example 1: The below examples illustrate the <dfn> tag in HTML.

HTML




<!DOCTYPE html>
<html>
 
<body>
 
    <!--HTML dfn tag-->
    <p>
        <dfn>Geeksforgeeks</dfn>
        is a portal for geeks.
    </p>
</body>
 
</html>


Output:

Example 2: In this example, we will see using title attribute of the <dfn> tag.

HTML




<!DOCTYPE html>
<html>
 
<body>
 
    <!--HTML dfn tag with title attribute-->
    <p>
          <dfn title="Geeksforgeeks">GFG</dfn>
            is a portal for geeks.
    </p>
</body>
 
</html>


Output:

Example 3: In this example, we will use title attribute of the <abbr> tag inside the <dfn> element.

HTML




<!DOCTYPE html>
 
<html>
 
<body>
   
    <!--HTML dfn tag with title attribute and abbr tag-->
    <p>
        <dfn>
            <abbr title="Geeksforgeeks">GFG</abbr>
        </dfn>
            is a portal for geeks.
    </p>
</body>
 
</html>


Output:

Example 4: In this example, we will use id attribute along with the <dfn> tag. 

HTML




<!DOCTYPE html>
<html>
 
<body>
 
    <!--HTML dfn tag with id attribute-->
    <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>


Output:

Supported Browsers

  • Google Chrome 15
  • Edge 12 and above
  • Firefox 1 and above
  • Opera 14 and above
  • Safari 6 and above


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads