Hi Folks,

I reckon this is a really simple question, but I can't figure it out. When I name a block (or menu) and place it on a site the name is always justified to the left. I'd like to have the block titles justified to the centre.

How do I do this?

Thanks for the help,
Mark C

Comments

abdullah5588’s picture

Hi, you can do so with very little css.

Search for your css file. Most probably it would be style.css in your selected theme.

In your css, there would something like

.block .title{
property:value;
}

try adding "text-align:center;" in above block.

Or if you are not good at css, send in your url. A lot of guys here will be able to help you better.

Abdullah
Information Planet
Oil Cups

vertazzar’s picture

download the module for firefox FIREBUG

https://addons.mozilla.org/en-US/firefox/addon/1843

than use the "inspect" tool from the firebug and click on desired block

in code you'll see the <div id="block-block-bla-bla-somethinglikethis">YOUR BLOCK CONTENT</div> copy the block-block-bla-bla-somethinglikethis and add in your style.css like this ;

#block-block-bla-bla-somethinglikethis .title {

text-align:center;

}

and it will apply only to that specific block

OR., you can use

.block .title {

text-align:center;
}

to apply the align center to ALL blocks in your site

markconroy’s picture

thanks I'll give those a try and get back to you.

Mark.

============

Drupal Core Maintainer for "Out of the Box" Initiative.

markconroy’s picture

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

  <div class="content">
    <?php print $block->content ?>
  </div>
</div>

This is what I find in /modules/system/block.tpl.php

There is no mention of .block in the default.css file (the only .css file with the theme). It's not a theme that is listed on Drupal.org, it's one I found here:
http://www.freedrupaltheme.com/dark-ritual

Should I add something to the block.tpl.php file? and if so, what? and where?

Thanks for the help.

============

Drupal Core Maintainer for "Out of the Box" Initiative.

GNA27’s picture

I have been trying to do the same thing unsuccessfully. My theme has a blocks.css and a styles.css, among several others. I have tried adding to the CSS to change the text alignment for only my specific block (block-block-10), but the change doesn't happen despite clearing all caches and trying this in both CSS files.

I'm using the CSS code suggested earlier in this thread. But somehow the theme or Drupal is overriding the code.

I'm using Drupal 7.