简体   繁体   中英

How to change collapse color on active?

I would like to change collapse heading color (background and font color):

http://jsfiddle.net/KbQyx/

How to make this thing ?

<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" data-target="#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>

</div>

I am assuming that data-accordion is only in <h4> tag.

Here is a working solution: jsfiddle

.panel-default > .panel-heading > .panel-title.collapsed > a{
    color: #333;
    background-color: #f5f5f5;
    border-color: #ddd;
  }


 .panel-default > .panel-heading > .panel-title:not(.collapsed) > a{
    color: #fff;
    background-color: red;
    border-color: red;
   }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM