Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use case of HTML Definition list, and issue with bootstrap

I use Definition list (dl, dd, dt ) to render view page (details of an entity). Are Description list are not good for this usecase?

When use with Twitter bootstrap, when <dd></dd> is empty, all of the contents shifts to top. This is undesirable to show details of an object, which may contain some properties empty.

Please see the fiddle here http://jsfiddle.net/cPwHr/

Is this a bug? how can I prevent it. Or should I use normal list (ul, li ..) or table.

like image 825
bsr Avatar asked Oct 05 '12 22:10

bsr


2 Answers

You can just use a non-breaking space if you don't have a definition instead of leaving it empty. That way all of the css rules will still be applied as expected.

        <dt>Description lists</dt>
        <dd>&nbsp;</dd>
like image 63
Bill Avatar answered Nov 18 '22 17:11

Bill


You can also use this style override:

.dl-horizontal > dd:after {
  display: table;
  content: "";
  clear: both;
}

Answer by @gael-marziou, see this thread: Prevent Twitter bootstrap empty <dd> filling with next <dd> value

like image 6
Rowe Morehouse Avatar answered Nov 18 '22 15:11

Rowe Morehouse