Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I wanted to display Who's Online block as an inline, comma separated list using css.
theme_item_list
generates markup like this:
<ul><li></li><li></li></ul>
A browser quirk means that due to the lack of whitespace, it won't wrap if you use display: inline;
.
But if you have markup like this it wraps fine:
<ul>
<li></li>
<li></li>
</ul>
To add the new line, you'll need to override theme_item_list
in your theme's template.php file, then change:
$output .= '<li'. drupal_attributes($attributes) .'>'. $data .'</li>';
to
$output .= '<li'. drupal_attributes($attributes) .'>'. $data .'</li>' ."\n";
You'll then see the line breaks in your generated html, inline lists will wrap, and all will be right in the world once more.