How to override Bootstrap's Panel heading background color?

后端 未结 11 1360
情书的邮戳
情书的邮戳 2021-01-31 08:08

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

11条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-31 08:27

    Bootstrap sometimes uses contextual class constructs. Those are what you should target to change styling.

    You don't need to create your own custom class as suggested in the answer from Kiran Varti.

    So you only need:

    CSS:

    .panel-default > .panel-heading {
      background: #black;
    }
    

    HTML:

    Explanation here. Also see contextual class section here.

    To match navbar-inverse use #222. Panel-inverse was requested in V3, but rejected due to larger priorities.

    You can change the foreground color in that heading override or you can do it separately for panel titles. Depends what you are trying to achieve.

    .panel-title {
      color: white;
    }
    

提交回复
热议问题