Bootstrap Tutorial - Style collapse button








The following code shows how to style collapse button.

Example

<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
  src='http://code.jquery.com/jquery-1.9.1.js'></script>
<script type='text/javascript'
  src="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/js/bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css"
  href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-combined.min.css">
<style type='text/css'>
button.btn.collapsed:before {<!-- w ww .j a  va  2s.co m-->
  content: '+';
  display: block;
  width: 15px;
}

button.btn:before {
  content: '-';
  display: block;
  width: 15px;
}
</style>
</head>
<body style='margin:30px'>
  <div class="row-fluid summary">
    <div class="span11">
      <h2>MyHeading</h2>
    </div>
    <div class="span1">
      <button class="btn btn-success collapsed" data-toggle="collapse"
        data-target="#intro"></button>
    </div>
  </div>
  <div class="row-fluid summary">
    <div id="intro" class="collapse">Here comes the text...</div>
  </div>
</body>
</html>

Click to view the demo