HTML5: How to define a term or name in a definition list?

Go To Exercise page


HTML Code:

<!DOCTYPE html><!-- Document type declaration for HTML5 -->
<html><!-- Start of HTML document -->
<head><!-- Start of head section -->
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><!-- Metadata for specifying character encoding -->
<title>Define a term or name in a definition list</title><!-- Title of the HTML document -->
</head><!-- End of head section -->
<body><!-- Start of body section -->
<dl><!-- Definition list starts -->
<dt>PHP</dt><!-- Term (definition term) -->
<dd>A server side scripting language.</dd><!-- Description (definition description) -->
<dt>JavaScript</dt><!-- Another term -->
<dd>A client side scripting language.</dd><!-- Another description -->
</dl><!-- Definition list ends -->
</body><!-- End of body section -->
</html><!-- End of HTML document -->


  • The document starts with the doctype declaration specifying that it is an HTML5 document.
  • Inside the <html> tags, the HTML document structure begins.
  • The <head> section contains metadata about the document, including the character encoding specified using the meta tag.
  • The <title> element sets the title of the HTML document.
  • The <body> section is where the visible content of the webpage resides.
  • <dl> defines a definition list.
    • <dt> represents a term in the list.
    • <dd> represents the description or definition of the term.
  • The HTML document ends with the closing </html> tag.

Live Demo:

See the Pen dt-answer by w3resource (@w3resource) on CodePen.

See the solution in the browser

Supported browser

Firefox logo Chrome logo Opera logo Safari logo Internet Explorer logo

Go To Exercise page

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.

Follow us on Facebook and Twitter for latest update.