Bootstrap Tutorial - Create an alert block with close button








The following code shows how to create an alert block with close button.

Example

<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css"
  href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-combined.min.css">
<script type='text/javascript'
  src="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/js/bootstrap.min.js"></script>
</head><!--from  w w  w.  j  a v  a  2s.  c o m-->
<body style='margin:30px'>
  <div class="alert alert-error alert-block" style="width: 200px">
    <button class="close" data-dismiss="alert("asdf")">&times;</button>
    <span>Before you can continuelds highlighted below.</span>
  </div>
</body>
</html>

Click to view the demo