How to define terms with HTML?

HTML provides several semantic elements for defining and clarifying terms within web content. These elements enhance accessibility, improve SEO, and help screen readers understand the meaning of specialized terminology. The definition element (<dfn>), abbreviation element (<abbr>), and definition list elements (<dl>, <dt>, <dd>) provide different approaches for marking up terms and their definitions.

Using the <dfn> Element

The <dfn> element marks the defining instance of a term. It should be used when introducing a term for the first time or providing its formal definition within the document.

Syntax

<dfn>term</dfn>

The <dfn> element can also include a title attribute to provide additional context or the full form of an abbreviation.

Example

Following example demonstrates how to define web development terms using the <dfn> element

<!DOCTYPE html>
<html>
<head>
   <title>Defining Terms with dfn Element</title>
   <style>
      dfn { font-weight: bold; color: #0066cc; }
   </style>
</head>
<body style="font-family: Arial, sans-serif; padding: 20px;">
   <h2>Web Development Terminology</h2>
   <p><dfn>HTML</dfn> stands for HyperText Markup Language and is the standard language for creating web pages.</p>
   <p><dfn>CSS</dfn> stands for Cascading Style Sheets and controls the visual presentation of HTML elements.</p>
   <p><dfn>JavaScript</dfn> is a programming language that adds interactivity and dynamic behavior to web pages.</p>
</body>
</html>

The output displays the defined terms in bold blue text, making them stand out from regular content

Web Development Terminology

HTML stands for HyperText Markup Language and is the standard language for creating web pages.
CSS stands for Cascading Style Sheets and controls the visual presentation of HTML elements.
JavaScript is a programming language that adds interactivity and dynamic behavior to web pages.

Using the <abbr> Element

The <abbr> element represents an abbreviation or acronym. The title attribute provides the full expansion, which appears as a tooltip when users hover over the abbreviation.

Syntax

<abbr title="full expansion">abbreviation</abbr>

Example

Following example shows how to use the <abbr> element with various organizations and technical terms

<!DOCTYPE html>
<html>
<head>
   <title>Abbreviations and Acronyms</title>
   <style>
      abbr { text-decoration: underline dotted; cursor: help; }
   </style>
</head>
<body style="font-family: Arial, sans-serif; padding: 20px;">
   <h2>Organizations and Technical Terms</h2>
   <p>The <abbr title="World Health Organization">WHO</abbr> provides international health guidelines.</p>
   <p><abbr title="Application Programming Interface">API</abbr> allows different software applications to communicate.</p>
   <p>Modern websites use <abbr title="HyperText Transfer Protocol Secure">HTTPS</abbr> for secure connections.</p>
</body>
</html>

The abbreviations appear with dotted underlines, and hovering over them reveals their full meanings in tooltips

Organizations and Technical Terms

The WHO provides international health guidelines.
API allows different software applications to communicate.
Modern websites use HTTPS for secure connections.

(Hovering over each abbreviation shows its full expansion)

Using Definition Lists (<dl>, <dt>, <dd>)

Definition lists provide a structured way to present terms with their descriptions. The <dl> element wraps the entire list, <dt> defines each term, and <dd> provides the corresponding definition.

Syntax

<dl>
   <dt>Term 1</dt>
   <dd>Definition for Term 1</dd>
   <dt>Term 2</dt>
   <dd>Definition for Term 2</dd>
</dl>

Example

Following example demonstrates a comprehensive glossary using definition lists

<!DOCTYPE html>
<html>
<head>
   <title>Web Development Glossary</title>
   <style>
      dl { margin: 20px 0; }
      dt { font-weight: bold; color: #333; margin-top: 15px; }
      dd { margin-left: 20px; margin-bottom: 10px; color: #666; }
   </style>
</head>
<body style="font-family: Arial, sans-serif; padding: 20px;">
   <h2>Web Development Glossary</h2>
   <dl>
      <dt>Frontend</dt>
      <dd>The client-side part of a web application that users interact with directly.</dd>
      
      <dt>Backend</dt>
      <dd>The server-side part of a web application that handles data processing and storage.</dd>
      
      <dt>Responsive Design</dt>
      <dd>An approach to web design that ensures websites work well on different screen sizes and devices.</dd>
      
      <dt>Framework</dt>
      <dd>A pre-built foundation of code that developers use to build applications more efficiently.</dd>
   </dl>
</body>
</html>

The output displays a well-formatted glossary with bold terms and indented definitions

Web Development Glossary

Frontend
    The client-side part of a web application that users interact with directly.

Backend
    The server-side part of a web application that handles data processing and storage.

Responsive Design
    An approach to web design that ensures websites work well on different screen sizes and devices.

Framework
    A pre-built foundation of code that developers use to build applications more efficiently.

Combining Multiple Approaches

For comprehensive term definition, you can combine these elements. Use <dfn> for the first occurrence, <abbr> for subsequent abbreviations, and <dl> for glossaries or reference sections.

Example

<!DOCTYPE html>
<html>
<head>
   <title>Combined Term Definitions</title>
   <style>
      dfn { font-style: italic; color: #0066cc; }
      abbr { text-decoration: underline dotted; }
      dt { font-weight: bold; margin-top: 10px; }
      dd { margin-left: 20px; }
   </style>
</head>
<body style="font-family: Arial, sans-serif; padding: 20px;">
   <h2>Understanding APIs</h2>
   <p>An <dfn title="Application Programming Interface">API</dfn> is a set of protocols and tools for building software applications.</p>
   <p>Many web services provide <abbr title="Application Programming Interface">API</abbr> access using <abbr title="JavaScript Object Notation">JSON</abbr> format.</p>
   
   <h3>API Types</h3>
   <dl>
      <dt>REST API</dt>
      <dd>Uses HTTP methods and follows REST architectural principles.</dd>
      <dt>GraphQL API</dt>
      <dd>Allows clients to request specific data using a query language.</dd>
   </dl>
</body>
</html>
HTML Elements for Defining Terms <dfn> Defining instance First occurrence Formal definition Example: <dfn>HTML</dfn> is... Use: Term introduction <abbr> Abbreviations Acronyms Tooltip expansion Example: <abbr title="...">WHO</abbr> Use: Short forms <dl> <dt> <dd> Definition lists Structured glossaries Term-description pairs Example: <dt>Term</dt> <dd>Definition</dd> Use: Comprehensive lists

Best Practices

When defining terms in HTML, follow these guidelines for optimal results

    Updated on: 2026-03-16T21:38:54+05:30

    549 Views

    Kickstart Your Career

    Get certified by completing the course

    Get Started
    Advertisements