Reputation: 107
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
</a>
</h4>
</div>
<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.
</div>
</div>
</div>
Upvotes: 7
Views: 48333
Reputation: 86
bg-default
<div class="panel-group" id="accordion">
<div class="panel bg-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapseOne">
Collapsible Group Item #1
</a>
</h4>
</div>
<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.
</div>
</div>
Upvotes: 0
Reputation: 1691
Bootstrap has built-in styles:
change
<div class="panel panel-default">
to
<div class="panel panel-primary">
all the other Bootstrap colours apply, so panel-success
panel-warning
etc
see here: Bootstrap Contextual colors
any other colour would require you to write a class to supplement the bootstrap classes e.g.
.panel-turquoise {
border-color: #32c5d2;
}
.panel-turquoise > .panel-heading + .panel-collapse > .panel-body {
border-top-color: #32c5d2;
}
.panel-turquoise > .panel-heading {
background-color: #eff3ff;
}
<div class="panel panel-turquoise">
Upvotes: 0
Reputation: 56
You likely need to create your own custom contextual state class for the panel. Bootstrap comes with a bunch built in, but if you want something completely different you'll need to add one. This for example would create a new contextual state class for the panels called flashy:
.panel-flashy {
border-color: #FF934F;
}
.panel-flashy > .panel-heading {
color:#fff;
background-color:#FF934F;
border-color:#ff934f;
}
HTML code:
<div class="panel panel-flashy">
<div class="panel-heading">
<h3 class="panel-title">Flashy Panel title</h3>
</div>
<div class="panel-body">
Panel content goes here
</div>
</div>
Upvotes: 0
Reputation: 13666
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 {
background-color:#000;
}
Upvotes: 7