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

lias’s picture

Figured it out.

#block-search-0 .content {
border:0px solid #bbb;
}
jacine’s picture

Hello,

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 :)

jacine’s picture

Status: Active » Closed (fixed)

wow, looks like we posted at the same time :)

glad you figured it out.

lias’s picture

Status: Closed (fixed) » Active

Thanks 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:

 #block-menu-165 .title {
background:#fff url(../isky/images/bg-sidebar-leftusr.jpg) no-repeat;
}

#sidebar .left .title #block-menu-165 {
background:#fff url(../isky/images/bg-sidebar-leftusr.jpg) no-repeat;
}

Neither worked to change the title background image.
Thanks!

jacine’s picture

If 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:

#sidebar .left .title #block-menu-165 {
background:#fff url(../isky/images/bg-sidebar-leftusr.jpg) no-repeat;
}

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:

#sidebar .left #block-menu-165 .title {
background:#fff url(images/bg-sidebar-leftusr.jpg) no-repeat;
}

Try downloading firebug. Learning CSS takes a lot of trial and error, but if you stay with it, you'll get it :)

lias’s picture

Thanks 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!

jacine’s picture

Status: Active » Closed (fixed)

You're welcome :)

Have fun with Firebug!

slash75’s picture

I 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;
}

slash75’s picture

Got is working ...

Just added the code below to the styles.css file.

Thanks Firebug!

#block-search-0 .content {
border: none;
}