Is there a <dl> definition in the list that each <dd> will have a <dt> tag?

Is there a <dl> definition in the list that every <dd> will have a <dt> ?

Example:

option1 for each <dd> exists its <dt> if <dt> empty:

 <dl> <dt></dt> <dd>value1</dd> <dt>name2</dt> <dd>value2</dd> </dl> 

option2 for each <dd> its <dt> <dd> does not exist if <dt> empty:

 <dl> <dd>value1</dd> <dt>name2</dt> <dd>value2</dd> </dl> 


Edit:

Example when dt can be empty (its assembly with zend_form auto - cannot be changed):

 <dl> <dt><lable>Last Name:</label></dt> <dd><input type='text' size='30' /></dd> <dt><lable></label></dt> <dd><input type='submit' size='30' value='submit'/></dd> <dt><lable>Name:</label></dt> <dd><input type='text' size='30' /></dd> </dl> 

thanks

+7
html html-lists
source share
5 answers

HTML 4 does not apply this, and is not XHTML 1.1 . They require only <dl> contains only one or more <dt> or <dd> s.

However, HTML 5 has more stringent requirements :

zero or more: (one or more <dt> elements followed by one or more <dd> elements)

Therefore, your option2 will not be validated in HTML 5.

option1 is still great, as <dt> can contain any "phrased content", including empty content.

+7
source share

According to HTML 4 DTD :

 <!ELEMENT DL - - (DT|DD)+ -- definition list --> 

This means that you can mix and match.

Here is a good overview of the different ways to use the definition list:

+3
source share

A dl containing only dd is checked in the W3C validator , so I think everything is fine.

W3C HTML 4.01 Link: 10.1 Introduction to Lists

Working example:

 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>Untitled</title> </head> <body> <dl> <dd>value1</dd> <dd>value2</dd> </dl> </body> </html> 
+2
source share

The tag is used in conjunction with (defines a list of definitions) and (describes an element in a list).
Copied from W3.

+1
source share

This is true, but I do not understand why you will ever want to do this.

Note that your second example really only applies to the first element; there is no further dt , since several dd elements can be used for one dt .

+1
source share

All Articles