I have a Definition List which displays User Info below someone’s photo in the Comments section.
The problem I just discovered, is that when a user doesn’t complete all of the optional Profile fields, my Definition List is collapsing.
Here is a screenshot…
Things should appear like this…
Joined:
Location:
Posts
Originally I was thinking this was a PHP/mySQL issue, and that my code needs to replace a NULL value with something else so things don’t collapse, but now I am wondering if crafting some smart CSS might accomplish the same thing, and with less fuss?!
I was thinking of adding <br />, but I’m not sure that is right.
The problem with definition lists is that you can’t easily have a clean break between the dt and the dd as they have no parent wrapped around each pair. Therefore if the dt or dd runs to zero lines or perhaps either runs to a few lines then you get a mismatch when the dt is floated because content will rise up or won’t be pushed down.
The only foolproof solution (apart from your scripting fix) is to use inline-block instead and to apply widths. This demo is from a similar thread a while back and shows that it works for any amount of content in either column and will still match up.