HTML <dt> Element

Publish in HTML Tutorial el 23/05/2025 20:03

The <dt> (Description Term) element is used to specify a term in a description list (<dl>). It's typically paired with one or more <dd> (Description Details) elements to create a name-value group in the description list. The <dt> element is part of the HTML description list structure, which is perfect for creating glossaries, metadata displays, or any other name-value pairs.


Basic Syntax

Here's the basic structure of how <dt> is used within a <dl> element:


Rendered Example

Here's how the above code would render:

Play Code


Examples of <dt> Usage

1. Simple Glossary

A basic glossary implementation using <dt> and <dd>:

Play Code


2. Multiple Descriptions for One Term

A single term can have multiple descriptions:

Play Code


3. Metadata Display

Using <dt> to display metadata or properties:

Play Code


4. Dynamic Glossary with JavaScript

Creating a glossary dynamically with JavaScript:

Play Code


5. Interactive FAQ Section

An interactive FAQ section using <dt> elements that can be clicked to show/hide answers:

Play Code


Tips and Tricks

  • Styling: You can style <dt> and <dd> elements differently to create visual distinction between terms and definitions.
  • Accessibility: Description lists are well-supported by screen readers, making them a good choice for accessible content.
  • Grouping: You can group multiple <dt> elements before a <dd> if several terms share the same definition.
  • Inline Elements: <dt> can contain inline elements like <span>, <a>, or <strong>, but not block-level elements.
  • Microdata: Consider adding schema.org microdata to your description lists for better SEO and rich snippets in search results.


Browser Support

The <dt> element is supported by all modern browsers and has excellent backward compatibility, working even in very old browsers.

También te puede interesar

HTML <style> Element
HTML <style> Element

The <style> HTML element contains style information for a document, or part of a document. ...

HTML <strong> Element
HTML <strong> Element

The <strong> element is used to indicate that its content has strong importance, seriousnes...

HTML <span> Element
HTML <span> Element

The <span> element is an inline container used to mark up a part of a text or document. Unl...

HTML <source> Element
HTML <source> Element

The <source> element is used to specify multiple media resources for media elements like &l...

HTML <small> Element
HTML <small> Element

The <small> element is used to represent side-comments and small print, typically for discl...

HTML <section> Element
HTML <section> Element

HTML <section> Element: The Complete Guide The <section> element is a semantic HTML ...