Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change content background colour for Jquery Accordion

Tags:

jquery

How to change content background colour for Jquery Accordion? I've tried to change it in CSS and JS file:

[CSS]

.ui-accordion-content {  
    width: 100%;  
    background-color: #f3f3f3;  
    color: #777;  
    font-size: 10pt;  
    line-height: 16pt;  
}  

[JS]

$(".ui-accordion-content").css("background", "#fcfff4")

none of them works.

like image 768
IceDawg Avatar asked Nov 20 '25 10:11

IceDawg


2 Answers

To answer: You need to be aware of CSS selector precedence.

You have to use a more specific CSS selector. Read the standard on what takes precedence for browsers choosing which CSS selectors for an element. So something like

#myAccordion .ui-accordion-content

might do it. Or you might have to be more specific.

Here are a few links to more information about this:

  • Precedence in CSS selector specifity conflicts (type vs class selector)
  • http://www.alternategateways.com/tutorials/css/css-101/part-four-the-css-order-of-precedence
like image 99
Precastic Avatar answered Nov 23 '25 02:11

Precastic


override .ui-widget-content

.ui-widget-content{
    background:red;
}

Look at this demo , I forked an accordion and just changed the background

like image 43
isJustMe Avatar answered Nov 23 '25 00:11

isJustMe