We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Accordion`s background color

Good evening,

how do I change Accordion`s background color? Or better, what do I do in order to make Accordion assume the parent component background color?

Thanks in advance!

5 Replies

AP Arun Palaniyandi Syncfusion Team July 19, 2019 11:54 AM UTC

Hi Társis, 
Thank you for contacting Syncfusion support. 
You can change the Accordion’s both header and content background color using CSS properties and we have prepared a sample for the same with background color customizations in Accordion for your reference.  
And like wise you can also apply the parent component’s color to the Accordion UI, using the below class names and CSS properties. 
 
<style> 
  
    .e-accordion {
        border-radius: 6px 6px 6px 6px;
        border: none !important;
    }
 

        /* header custom css*/
        .e-accordion .e-acrdn-item .e-acrdn-header {
            background-color: rgb(255, 204, 255);
            border-radius: 6px 6px 6px 6px;
        }
 

            /*header on hover custom css*/
            .e-accordion .e-acrdn-item .e-acrdn-header:hover {
                background-color: rgb(255, 51, 255);
            }
 

        /*header on selected and expanded custom css*/
        .e-accordion .e-acrdn-item.e-select.e-expand-state > .e-acrdn-header {
            background: rgb(255, 204, 255);
        }
 
  
        .e-accordion .e-acrdn-item.e-select.e-selected.e-expand-state > .e-acrdn-header {
            background: rgb(255, 128, 255);
        }
 
  
        .e-accordion .e-acrdn-item.e-expand-state.e-select:not(.e-selected) > .e-acrdn-header:focus {
            background: rgb(255, 204, 255);
        }
 
  
        /*content custom css*/
        .e-accordion .e-acrdn-item .e-acrdn-panel .e-acrdn-content {
            background-color: rgb(222,238,172);
            border-radius: 6px 6px 6px 6px;
        }
 
  
</style> 

Output: 
 
 

Please let us know if you need further assistance.  

Regards,  
Arun P.  



Társis July 19, 2019 06:40 PM UTC

Thank you for your answer,
I could manage to change the background color of the headers, but now a thin white line appears between them. How can I avoid that? And how can I change the header text color (I'm talking about the not active ones)

Thanks in advance!


AP Arun Palaniyandi Syncfusion Team July 22, 2019 12:45 PM UTC

Hi Társis, 
Thank you for your update. 
We have achieved your requirement to remove white line between headers and to change the inactive header text color in the below attached sample. 
 
<style> 
  
    .e-accordion {
        border-radius: 6px 6px 6px 6px;
        border: none !important;
    }
 

        /* header custom css*/
        .e-accordion .e-acrdn-item .e-acrdn-header {
            background-color: rgb(255, 204, 255);
            border-radius: 6px 6px 6px 6px;
        }
 

            /*header on hover custom css*/
            .e-accordion .e-acrdn-item .e-acrdn-header:hover {
                background-color: rgb(255, 51, 255);
            }
 

        /*header on selected and expanded custom css*/
        .e-accordion .e-acrdn-item.e-select.e-expand-state > .e-acrdn-header {
            background: rgb(255, 204, 255);
        }
 
  
        .e-accordion .e-acrdn-item.e-select.e-selected.e-expand-state > .e-acrdn-header {
            background: rgb(255, 128, 255);
        }
 
  
        .e-accordion .e-acrdn-item.e-expand-state.e-select:not(.e-selected) > .e-acrdn-header:focus {
            background: rgb(255, 204, 255);
        }
 
  
        /*content custom css*/
        .e-accordion .e-acrdn-item .e-acrdn-panel .e-acrdn-content {
            background-color: rgb(222,238,172);
            border-radius: 6px 6px 6px 6px;
        }
 
 
/*to remove the white line*/ 
        .e-accordion .e-acrdn-item.e-select {
            border-bottom: 1px solid white !important;
            border-top: 1px solid white !important;
        }
 
 /*to change the accordion header color*/ 
        .e-accordion .e-acrdn-item .e-acrdn-header .e-acrdn-header-content {
            color: yellowgreen;
        }
 
 
  
</style> 
 
 



Please let us know if you need further assistance.  

Regards,  
Arun P.  



Társis July 22, 2019 02:02 PM UTC

It worked. Tank you very much!


KK Karthigeyan Krishnamurthi Syncfusion Team July 24, 2019 05:01 AM UTC

Hi Tarsis  

We are happy that our solution fulfilled your requirement. 

Please let us know for further assistance. 

Regards, 
Karthi 


Loader.
Live Chat Icon For mobile
Up arrow icon