Bootstrap collapse panel has visual problems using a collapse icon instated of heading


I am using a few collapsible bootstrap panels and instate of collapsing by clicking on the header as the example, I have an icon on the right side of the header that triggers the collapse. The collapse transition has a visual problem when doing that as you can see in the jsfiddle. It shrinks all panel-body content to position where the icon lies. See the JSFiddle for a simplified example.



<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="">

<!-- Latest compiled and minified JavaScript -->
<script src=""></script>
<link rel="stylesheet" href="//">
<div class="panel-group">
  <div class="panel panel-default" id="panel1">      
    <div class="panel-heading">
      <a class="btn btn-collapse pull-right" data-toggle="collapse" href="#collapseOne">
        <i class="fa fa-caret-square-o-up"></i>
      <h4 class="panel-title">
        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.


If you add this style rule


to your a tag your problem is solved. Don’t know if it’s the best solution, but it works.

Answered By – doru

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published