By mxer269 on
Hi guys,
Is it possible to edit the width of only one specific block? I have a block that is only shown on one page. I would like the width of this block to be less wide. Can I do this?
I know the code to edit the width of the left side bar block that I want. This is what I added:
#sidebar-left .block {
border-collapse:collapse;
border-spacing:0pt;
margin:0px 0px 10px;
padding:0px;
width:100px; }
I edited this in blocks.css.
Anyway, I only want this width to apply to one specific block. Any suggestions?
Comments
It depends on your site.
It depends on your site. Drupal gives block has a unique ID, and you can reference that block exclusively by using it's ID. You'll have to look at your HTML source to figure out what it is, though (Or use Firefox and Firebug...).
-Corey
Or Use Blocktheme module, your choice.
BlockTheme allows an admin to define tpl files for standard block templates
and provides a select box on the block configure form so the user can select
a tpl file to use as opposed to having to override the templates by block ID.
It's 6.x-1.0-beta1, but I haven't had any issues with it.
http://drupal.org/project/blocktheme
...
As coreyp_1 states every block as an ID, usually in the form of #block-module-delta (the delta is usually a number but not always). You will find the id on the block wrapper div, and it will look like this:
You don't need the Blocktheme module, not for changing the width of ONE block in your whole site, that module is great as a simple admin UI for assigning styles to blocks, but for your case its massive overkill.
Pimp your Drupal 8 Toolbar - make it badass.
Adaptivetheme - theming system for people who don't code.
thanks guys!
thank you so much! I correctly identified the block id, added it by using #block-block-8, then added this tag to get the correct width:
#block-block-8 {
width: 160px;
}
Thank you again!