Closed (fixed)
Project:
Sky
Version:
5.x-1.7
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
12 Nov 2007 at 21:37 UTC
Updated:
24 Jul 2010 at 17:51 UTC
Hi there, I've been trying to eliminate the border around certain blocks like the search block but haven't had success. I've tried the following for div id="block-search-0" class="block block-search" but it hasn't changed anything:
#block block-search{
overflow:hidden;
width:230px;
margin:0 0 15px;
padding:0;
}
#block block-search{
border:0px solid #bbb;
padding:10px;
}
I would like to be able to modify the style of individual blocks but I can't seem to pinpoint the correct style. TIA for your help.
Comments
Comment #1
lias commentedFigured it out.
Comment #2
jacineHello,
Your CSS is wrong, that's why :)
It's probably confusing because there are more than one class attached to each of those attributes, but here's what it should look like for your example:
<div id="block-search-0" class="block block-search"If you were overriding the "id" attribute, you would do it like this (note the # sign, which is CSS is for the id attribute and is called a selector):
#block-search-0 {
overflow:hidden;
width:230px;
margin:0 0 15px;
padding:0;
}
If you wanted to use the "class" instead, you would do it like this (note the "." before the class name, which in CSS stands for the class attribute):
.block-search {
overflow:hidden;
width:230px;
margin:0 0 15px;
padding:0;
}
You only need to pick one of these, and it should work.
There is never a space in the name of a CSS class or selector. If you see a space between a class that means that two classes are being applied to the element, which is normal in Drupal.
In the above example the "block" part of class="block block-search" means that both of these CSS classes (if they exist) would be applied:
.block { whatever CSS }
.block-search { whatever CSS }
Hope that helps you :)
Comment #3
jacinewow, looks like we posted at the same time :)
glad you figured it out.
Comment #4
lias commentedThanks JGirlyGirl for the explaination, you're fast!
One more quick question on block style, I would like to change the title image background for a block. The block is #block-menu-165 and it's the .title background image I want to modify. I tried out the following:
Neither worked to change the title background image.
Thanks!
Comment #5
jacineIf you check the block using Firebug (which I highly recommend for learning this stuff), you'll see this is the style that is applied to the sidebar title for a left sidebar layout:
#sidebar .left .title{background:#fff url("images/bg-sidebar-left.jpg") no-repeat;}Again, your code appears wrong, as #block-menu-165 is an id that is applied to the block itself. With CSS your classes and selector must be written in perfect order, or it's not going to work. You tried:
The above is wrong because it says that the #block-menu-165 is inside of
<div class="title">, which is not the case. Switching that around and fixing the image path should work:Try downloading firebug. Learning CSS takes a lot of trial and error, but if you stay with it, you'll get it :)
Comment #6
lias commentedThanks for your patience and help, thanks for the info about the order of classes and selectors. The style worked, yay! It's great learning something new.
I am off to download firebug. Looking forward to seeing your new site too : )
Mil gracias!
Comment #7
jacineYou're welcome :)
Have fun with Firebug!
Comment #8
slash75 commentedI am trying to remove the border around the search block.
I added the css below to styles.css but the border still shows up.
#block-search-0 {
overflow:hidden;
width:230px;
margin:0 0 15px;
padding:0;
}
Comment #9
slash75 commentedGot is working ...
Just added the code below to the styles.css file.
Thanks Firebug!
#block-search-0 .content {
border: none;
}