HTML - <dd> Tag



The HTML <dd> tag is used to define the description, definition, or value of the preceding data term <dt> in the description list <dl>.

Inside the <dd> tag, we can use put paragraph(<P>), line breaks(<br>), images(<img>), links(<a>), lists, etc.

The <dd> elements include the global attributes.

Following is the global attribute that we can use within the <dd> tag −

  • nowrap −If the value of the nowrap attribute is set to "yes", then the description text will not wrap. The default value for this attribute is "no".

Syntax

Following is the syntax of the <dd> tag −

<dt>
   <dd></dd>
   <dd></dd>
   ….
</dt>

Example

In the following program, we are creating a description list using <dl> tag. Then, we create a single data description using the <dd> tag within the <dl> tag to display the list item's data description.

<!DOCTYPE html>
<html lang="en">
<head>
   <title>HTML Description lists</title>
</head>
<body>
   <!--create a description list-->
   <dl>
      <dt>HTML</dt>
      <dd>Hyper Text Markup Language(single data description).</dd>
   </dl>
</body>
</html>

When we run the above code, it will generate an output consisting of the text displayed on the webpage.

Example

The following is another example of the HTML <dd> tag. Here, we are creating multiple data descriptions using <dd> tags within <dl> tags to display the data details of the data word.

<!DOCTYPE html>
<html lang="en">
<head>
   <title>HTML Description lists</title>
</head>
<body>
   <!--create a description list-->
   <dl>
      <dt>CSS</dt>
      <dd>Cascading Style Sheet.</dd>
      <dd>It is used give the styles of the web pages.</dd>
      <dd>It manages the padding, margin, color, size of the HTML contents.</dd>
   </dl>
</body>
</html>

On running the above code, the output window will pop up, consisting of text displayed on the webpage.

Example

In this example, we create a description list using the <dl> tag. Then, we are using the nowrap attribute with the <dd> tag to manage the wrapping of the description text. We are giving the value of the nowarp attribute as "yes", which defines that the data description text will not be wrapped.

<!DOCTYPE html>
<html lang="en">
<head>
   <title>HTML Description lists</title>
</head>
<body>
   <!--create a description list-->
   <dl>
      <dt>Paragraph</dt>
      <dd nowrap="yes">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Dolorum error illum ipsum perspiciatis voluptatem, ab rem, laboriosam alias voluptatibus deleniti commodi eveniet? Recusandae, accusantium ex facilis enim odio rem in?</dd>
   </dl>
</body>
</html>

When we run the above code, it will generate an output displaying the text on the webpage.

Example

In this program, we are using <dd> and <dt> tags to create multiple data descriptions and multiple data terms within the description list <dl> to display the data terms and data description of the preceding data terms.

<!DOCTYPE html>
<html lang="en">
<head>
   <title>HTML Description lists</title>
</head>
<body>
   <!--create a description list-->
   <dl>
      <dt>Name</dt>
      <dd nowrap="yes">Rohan</dd>
      <dt>Age</dt>
      <dd nowrap="yes">22</dd>
      <dt>Address</dt>
      <dd nowrap="no">Vill: Lambhua, City: Sultanur, pin-code: 228152, State: Uttar Pradesh, Country: India</dd>
   </dl>
</body>
</html>

On running the above code, it will generate an output displaying the text on the webpage.

html_tags_reference.htm
Advertisements