.pre-scrollable - Makes a <pre> element scrollable (max-height of 350px and provide a y-axis scrollbar) - HTML CSS Bootstrap Class List

HTML CSS examples for Bootstrap Class List:pre-scrollable

Introduction

If you add the .pre-scrollable class, the pre element gets a max-height of 350px and provides a y-axis scrollbar

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<head>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.6/umd/popper.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js"></script>
</head><!--from ww w  .j  a  v a2s. c  om-->
<body>

<div class="container">
  <h2>Code</h2>

  <p>For multiple lines of code, use the pre element:</p>
  <pre> 
  This is a test. 
  This is a test. 
  This is a test.
  This is a test. 
  This is a test. 
  This is a test.
  This is a test. 
  This is a test. 
  This is a test.
  This is a test. 
  This is a test. 
  This is a test.
  This is a test. 
  This is a test. 
  This is a test.
  This is a test. 
  This is a test. 
  This is a test.
  This is a test. 
  This is a test. 
  This is a test.
  
  </pre>

  
  <pre class="pre-scrollable">
  This is a test. 
  This is a test. 
  This is a test.
  This is a test. 
  This is a test. 
  This is a test.
  This is a test. 
  This is a test. 
  This is a test.
  This is a test. 
  This is a test. 
  This is a test.
  This is a test. 
  This is a test. 
  This is a test.
  This is a test. 
  This is a test. 
  This is a test.
  This is a test. 
  This is a test. 
  This is a test.
  This is a test. 
  This is a test. 
  This is a test.
  
  </pre>
</div>

</body>
</html>

Related Tutorials