Kory Hershock Kory Hershock - 1 year ago 185
CSS Question

How do I change the background-color of an accordion tab in Bootstrap?

enter image description here

I am trying to change the background color of the tabs on my accordion. When I change the background color in CSS, it just changes the color behind the text and not the entire thing.

Here is a segment of my code:

<div class="panel-group" id="accordion">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapseOne">
Collapsible Group Item #1
<div id="collapseOne" class="panel-collapse collapse in">
<div class="panel-body">
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.

Answer Source

You are probably changing the background-color of the anchor tag if only the text's background is changing, instead, use the following CSS selector to change the background-color of the panel-heading:

.panel-default > .panel-heading {
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download