Definition lists (as used in user profiles) are of the following syntax:

<h3>CATEGORY</h3>
<dl>
<dt>TITLE</dt>
<dd>ATTRIBUTES</dd>
</dl>

In order to be able to properly align it so that all dd lines are flush, the dd tag needs a margin-left css attribute, otherwise, linebreaks or bullet lists within the dd tag will format incorrectly as in the attached bullet list in definition list. (see example 8 of this article for proper css required: Definition lists – misused or misunderstood?)

Unfortunately, themers can't do this with the current default, because many popular modules have adopted a convention of neglecting the TITLE to create left-aligned ATTRIBUTES (like in the attached dd tag beneath header):

<h3>Newsletter</h3>
<dl>
<dt></dt>
<dd>Manage my subscriptions</dd>
</dl>

In this case, adding a margin-left to the .profile dd style rule would disrupt this adopted convention by indenting that description.

So themers, purposefully or not, tend to leave out the margin-left style, creating sloppy css, because doing it might mess with the formatting of many other module.

This could be dealt with easily in core. I propose that when a $title variable doesn't contain any data, the dt tag simply isn't printed. I think most would agree that an empty tag is messy code anyhow. This would allow themers to easily use the dt + dd css selector to select only dd tags with dt siblings to style with the margin-left attribute, and other modules would still be able to continue leaving the dt title blank in order to get non-indented text.

Here's the new content for user-profile-category.tpf.php that would fix this:

...
<?php if ($title) : ?><dt<?php print $attributes; ?>><?php print $title; ?></dt><?php endif; ?>
<dd<?php print $attributes; ?>><?php print $value; ?></dd>

Comments

jfn99’s picture

Anyone knows how to show the empty fields box?

Status: Needs review » Closed (outdated)

Automatically closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.