I am using a definition list for some elements on the page and need them to display inline, e.g.: they normally look like:
<def term>
<def desc>
<def desc>
and I need them to look like (note the multiple DD's):
<def term> <def desc> <def desc>
<def term> <def desc> <def desc>
<def term> <def desc> <def desc>
I can get them to work fine using floats in moz but no matter what I try they will not work in IE, I typically get something like:
<def term> <def desc> <def desc> <def desc> <def desc> <def desc> <def desc>
<def term>
<def term>
Has anyone found a solution to this problem, I would really like to avoid adding extra markup where possible, but short of changing them to an unordered list im out of ideas :(
Thanks in advance
default stylesheet
ie 6 & 7 stylesheet:
ie6
Hope that helps.
Have you tried clearing the float in the dt's? Like this:
Edit: Here's a cross-browser solution that validates:
However, as you can see, that br is pretty nasty and non-semantic. Hopefully someone else can come up with a better solution. :)
just give them all layout , most simple way is to use CSS property .yourstuff { zoom: 1; }
This works (admittedly only tested on FF 3.x.x and Opera 9.x, both on Ubuntu 8.04):
CSS:
HTML:
Link to working example, tested under FF 3 and Opera 9.x:
http://www.davidrhysthomas.co.uk/so/dls.html
Note: you have to avoid spaces between the DD elements for this work work correctly.
No need for hacks for IE8+:
If you don't need to support IE8, skip the 4th CSS rule and just use this selector for the 3rd one:
dt:not(:first-child):before
The result should be something like this: (demo)
If you want to be real cool, you can replace the 2nd rule with this:
The result should be something like this: (demo)