1

I have a custom menu placed in the sidebar1 region of a fusion-based sub theme. The menu is displayed with the Menu name as the block title. When displayed, the title is styled with <h2 class="title block-title">. If I set colors and backgrounds in css style sheet as h2.title.block-title {}, all block titles on the page for all regions are styled the same way, but I would like to limit the style to just one specific menu. When rendered, the menu block is embedded within a couple <div> levels including one for the region <div class="sidebar-first-inner">. Using h2.title.block-title.sidebar-first-inner {} does not work. How do I limit the style to just this one location of h2?

2

you could use

div.sidebar-first-inner h2.title {
   whatever css rules you need
}

which means set the css of an h2 with class title that is within a div with class sidebar-first-inner

  • 2
    also, you would only need to use h2.title.block-title if there are other h2s in there that have a class of title but not block-title, too, eg, h2 class="title something-else" – Jimajamma Dec 13 '11 at 22:42
  • Yep, unfortunately fusion puts the combined group everywhere! – Ashlar Dec 14 '11 at 1:12
  • That doesn't matter, setting h2.title will find every h2 with a class of title regardless of any other classes it has while h2.title.block-title will only find h2s with both classes. if you had an h2 class="title block-title red large anynumberofotherclasses" it would find it, too :) – Jimajamma Dec 14 '11 at 1:27
1

The solution provided by Jimajamma will work, but it will also affect all blocks' titles in the sidebar-first region. In case you want to add additional blocks to that region in the future, it would be best to limit your CSS rule to that specific block. If you inspect the HTML, the wrapping div on the menu block should have an ID something like "block-block-menu-1". So, the ideal CSS selector would be something like:

#block-block-menu-1 h2.block-title { //styles go here }

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.