Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to override Bootstrap's Panel heading background color?

I'm using a Panel from Bootstrap however for the heading I want to use my own background color for the heading. When I don't put panel-heading class for the div, the layout gets screwed. So I thought I should keep panel-heading but then find a way to override the background color. So I decided to create a custom css class and use background-color and then add it to the div with panel-heading. But this didn't make any effect.

Any idea how to override the heading color of the panel?

Code:

<div class="panel panel-default">   <div class="panel-heading custom_class" >   </div> </div> 
like image 537
Jack Twain Avatar asked Oct 22 '14 10:10

Jack Twain


People also ask

How do I change the color of my accordion header?

You can add this under Custom > CSS in the Customizer and change the color value according to your preference. To check the alignment issue, please provide us with a URL to your page. Thanks! Thanks for the quick reply!

How do I make the background white in bootstrap?

Add a class bg-white to your html element. Then in apply the background style.

Can you give a div a background color?

You can use inline CSS in the HTML, or by using the bgColor attribute. You can use the bgColor attribute, like bgColor="#6B6B6B" , in the body element to change the background-color of <body> . The HTML bgcolor attribute is used to set the background color of an HTML element.


2 Answers

This should work:

.panel > .panel-heading {     background-image: none;     background-color: red;     color: white;  } 
like image 66
Marco Avatar answered Sep 21 '22 10:09

Marco


You can create a custom class for your panel heading. Using this css class you can style the panel heading. I have a simple Fiddle for this.

HTML:

<div class="panel panel-default">    <div class="panel-heading panel-heading-custom">        <h3 class="panel-title">Panel title</h3>    </div>    <div class="panel-body">        Panel content    </div> </div> 

CSS:

.panel-default > .panel-heading-custom { background: #ff0000; color: #fff; } 

Demo Link:

http://jsfiddle.net/kiranvarthi/t1Lq966k/

like image 25
KiV Avatar answered Sep 23 '22 10:09

KiV