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.
By Sms2luv on
I have added content to my main page but it is not looking good
I want to add borders to all blocks in a content region
Please tell me the code required to do this
Also tell me which tpl file to edit
Comments
You would add css to the
You would add css to the themes css to add the borders. You can use a tool like firebug to inspect the generated page and determine what css id and/or classes you want to apply the css to.
Could you please explain in
Could you please explain in details
Pure CSS
There is no need to edit any tpl.php file for what you want to achieve, but - especially in Drupal – you have to be familiar with CSS (and I emphasize the C for "Cascading"). As soon as you create a block, Drupal automatically creates SEVERAL CSS classes around it, like (depending on the theme you use)
#block
.block
.block-01
.block-inner
So if you define
#block {background:yellow}
in your CSS, ALL blocks will become yellow. But every block will also have its unique CSS class (.block-1 in the example above) which allows to address it as a single element. As said, a good understanding of CSS in general really helps. But keep in mind that Drupal creates a lot of classes out of the box (contrary to competitors, which output a blank page per default)