1

Using Drupal 7 with custom zen subtheme. I created a footer block to hold standard copyright information. But this block is left aligned, how do I center my footer block?

UPDATE

Below is the HTML for my footer. What CSS selector should I use to identify my footer block?

<div class="region region-footer">
 <div id="block-block-1" class="block block-block contextual-links-region first last odd">
  <div class="contextual-links-wrapper contextual-links-processed">
   <div class="content"> &copy; Copyright 2011 example.com </div>
  </div>
 </div>
</div>

3 Answers 3

2

You could either:

  • Add {text-align: center} to your footer region or block.
  • You could specify a width for your block and add {margin: 0 auto}.
4
  • See my update. Which css selector should I use to identify my footer block?
    – User
    Nov 28, 2011 at 8:17
  • use either .region-footer .block {} or #block-block-1 {}
    – ipwa
    Nov 28, 2011 at 17:31
  • I don't like the idea of using #block-block-1 because on reading the css you have no idea what #block-block-1 is.
    – User
    Nov 28, 2011 at 17:44
  • Use /**/ comments.
    – ipwa
    Nov 28, 2011 at 19:38
1

Select the class for the element containing the footer block; then add the following CSS properties:

.class {
  margin: 0 auto;
  text-align: center;
  width: 10%;
} 

(Replace .class with the class of the container.)

1
  • OP has posted the HTML structure, can you please explain more with exact CSS rule?
    – niksmac
    Dec 4, 2012 at 10:46
0

just use the footer tag which is part of the default Zen theme to centralise your footer.

#footer {
    text-align: center;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.