Display dt tag side by side instead of one below the other

I want to display dtan HTML tag side by side, and not one below the other For example: -

<dl class='Desktop'>
  <dt class='first'>first</dt>
  <dt class='Second'>second</dt>
  <dt class='third'>third</dt>
</dl>

Output: first second third

0
source share
3 answers

I like all the other answers as they are good, but I think mine is much simpler and does not require IE hacks:

dt {
    display: inline;
}
+1
source
dl.Desktop dt{float:left;}

Get them side by side. Here is an example: http://jsfiddle.net/zD8bs/ .

Note: Additional style may be required to work properly.

0
source

You can either make them float to the left:

dt {
    float: left;
}

Or make them an inline block:

dt {
    display: inline-block;
    zoom: 1; /* IE hack */
    *display: inline; /* IE hack */
}

Why an inline unit may be desirable .

0
source

All Articles