What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 128 Stack Exchange communities.

Among allowed HTML tags there are tags which together form 'definition list', namely <dl> (definition list), <dt> (definition term), and <dd> (definition description) elements. They can be useful among others to create e.g. glossary of terms... well, they could if they have any sensible style associated with them.

I would really like to have better CSS style associated with 'definition list'.

The following source (which has empty line after first item, which sometimes is and sometimes isn't visible in source view below).

<dl>
<dt>description term</dt> <dd>description definition</dd>

<dt>lorem ipsum</dt>
<dd>    Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</dd>
</dl>

generates the following output:


description term
description definition
lorem ipsum
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

which has horrible style, and is unusable (IMHO) as it is now.

In the case it got corrected the output looks like the following:


description term
description definition
lorem ipsum
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.


BTW. I couldn't find how to do 'definition list' using Markdown formatting: is there any?

share|improve this question
3  
Oh the HTMLanity! It does look horrid though. –  random Sep 22 '09 at 9:57
1  
It doesn't look like Markdown syntax supports definition lists: daringfireball.net/projects/markdown/syntax#list –  Jakub Narębski Sep 22 '09 at 10:14

3 Answers 3

In this case, it looks like Markdown lacks... **removes sunglasses** definition.

It should at least indent the definition descriptions to provide some visual cue that you're dealing with a list not ordinary.

definition term
  definition description 

definition term
  definition description 

The above is really just this:

<b>definition term</b>
  definition description 

<b>definition term</b>
  definition description

But really should have some kind of difference between the DT and the DD on the DL. Unless there are plans to just tweak the CSS and they just have it on the... DL.

share|improve this answer
    
Could you show the source of the above? –  Jakub Narębski Sep 22 '09 at 12:06
1  
He's using pre tags around the whole thing for formatting, with b tags for emphasis on terms. –  ベレアー アダム Sep 22 '09 at 12:16
1  
@Jakub: meta.stackoverflow.com/revisions/… –  Ladybug Killer Sep 22 '09 at 12:31
1  
+1 for dramatic aestetics. Shouldn't pre encode <b>? –  perbert Sep 22 '09 at 13:24
    
@smeagol PRE just keeps the linebreaks, spaces and tabs in place while formatting in a fixed-width font. Tags still work. –  random Sep 22 '09 at 13:29
    
It looks like <pre> is only about Markdown markup and preserving whitespace. It is not the same as <pre> in HTML. –  Jakub Narębski Sep 22 '09 at 14:58
2  
@Jakub: Contrary to popular belief, <pre> in HTML is also only about preserving whitespace. –  Zarel Oct 31 '09 at 1:35
2  
@random: YEEEEEEEEEEEEAAAAAAAAAAAAAHHHHHHHHHHHHHHHHHHHH!!!!!!!!!!!!! (Incredibly late, but you deserved it.) –  Pops Jul 15 '10 at 15:10
    
I would really love to see this implemented. I don’t care if we have to use real (or semi-real) HTML instead of Markdown. It’s worth it. –  tchrist Jan 13 '13 at 17:21

In all these years of writing blog posts by hand (including typing out all the HTML tags) I have never really understood the purpose of the <dt>, <dd>, and <dl> tags.

I guess I am a HTML neanderthal.

share|improve this answer
3  
If you're taking the KBD from Meta, at least give us the DL-DT-DL –  random Oct 2 '09 at 9:36
2  
"Definition lists vary only slightly from other types of lists in that list items consist of two parts: a term and a description." "definition lists can be used to tie together any items that have a direct relationship with each other (name/value sets)." Wikipedia markup uses ; term : definition –  endolith May 27 '11 at 16:10
    
One (not necessarily correct or complete) way of thinking is that items in unordered lists use the same marker, in ordered lists use an automatically generated marker, and in definition lists use an explicitly specified marker. –  outis Jan 25 '12 at 5:15

FWIW: I have always thought that <dl> should work as follows:

<dl>

<li>

<dt>pony</dt>

<dd>any of various breeds of small gentle horses usually less 
    than five feet high at the shoulder</dd>

</li>

...

</dl>

because an item in a glossary consists both of the term and its definition.

share|improve this answer
5  
If that's the case, you're writing it semantically wrong. LI only appear inside OL and UL. –  random Oct 2 '09 at 9:45
1  
@random I believe you are missing my point. I know that <LI> currently cannot appear in <DL>. I am saying it should with <DT> and <DD> providing the constituent parts of the item. –  Sinan Ünür Oct 2 '09 at 9:59
2  
Why? <dt> delimits the term, and <dd> delimits the definition. Why would you need an extra list tag? –  endolith May 27 '11 at 16:11
    
... and why would you want to change the HTML standards? This is about styling existing HTML element structures with CSS - NOT changing standards. –  awe May 18 '12 at 11:11
2  
@awe Oh, I can count a ton of reasons why HTML standards should be changed. In fact, I might be under the mistaken impression that they have changed many times. The fact that both the term and its definition form a whole, i.e. neither stands on its own, and therefore they should be contained in an item is either self-evident or not. The fact that they are not, makes styling hard. –  Sinan Ünür May 18 '12 at 13:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .