Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does definition list <dl> require that each <dd> will have <dt> tag?

Does definition list <dl> require that each <dd> will have <dt> tag?

Example:

option1 for each <dd> exist his <dt> also if <dt> empty:

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

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

<dl>

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


Edit:

Example for when dt can be empty (its build by zend_form auto - can not 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

like image 840
Ben Avatar asked Jul 18 '10 09:07

Ben


People also ask

What is DT and DD in description list?

Definition and Usage The <dd> tag is used to describe a term/name in a description list. The <dd> tag is used in conjunction with <dl> (defines a description list) and <dt> (defines terms/names). Inside a <dd> tag you can put paragraphs, line breaks, images, links, lists, etc.

What is DT in description list?

The <dt> tag defines a term/name in a description list. The <dt> tag is used in conjunction with <dl> (defines a description list) and <dd> (describes each term/name).

What are the tags used in definition list?

The <dl>, <dt> and <dd> tags are used to define description list.

Which tag in DL tag is used to define the definition term part?

Definition and Usage The <dl> tag is used in conjunction with <dt> (defines terms/names) and <dd> (describes each term/name).


1 Answers

HTML 4 doesn't enforce this, neither is XHTML 1.1. They only require <dl> contains only one or more <dt> or <dd>s.

However, HTML 5 has stricter requirement:

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

Hence, your option2 will not validate in HTML 5.

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

like image 53
kennytm Avatar answered Sep 25 '22 14:09

kennytm