If I don't specify title for a block, then the code looks like this:

[...]

[...]

But h2.title has 1px solid border, so a narrow empty box will appear above a block which has no title.

Comments

Bence’s picture

Oops :) So the code look like this:

[...]
<div class="block block-block" id="block-block-6">
    <h2 class="title">
          </h2>
[...]
jwolf’s picture

Assigned: Unassigned » jwolf
Category: bug » task
Priority: Normal » Minor

Solution is to edit block.tpl.php as follows:

  <div class="block block-<?php print $block->module; ?>" id="block-<?php print $block->module; ?>-<?php print $block->delta; ?>">
  
    <?php if($block->subject) : ?>
    <h2 class="title">
      <?php print $block->subject; ?>
    </h2>
    <?php endif; ?>
    <div class="content">
      <?php print $block->content; ?>
    </div>
  </div>

Note the:

    <?php if($block->subject) : ?>
    <h2 class="title">
      <?php print $block->subject; ?>
    </h2>
    <?php endif; ?>
prfctgdess’s picture

OK, this may sound dumb, but I'm a Drupal newbie, so please bear with me. :P

I'm having this problem too, and I understand your solution, but where do I find block.tpl.php? I can't seem to find it! Thanks.

jwolf’s picture

block.tpl.php is located in the theme's directory; it came with the theme.

jefftrnr’s picture

I believe another solution is to put the string <none> within the block title field, if you don't want to show the title.

Anonymous’s picture

Putting < does not work for me..

Anonymous’s picture

The Solution provided by Jwolf worked perfectly.
Thanks

sk33lz’s picture

Added jwolf's code in #2 to 6.x-1.x-dev, and will also be available in 6.x-1.4 release.

sk33lz’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.