Introduction to Bootstrap


What is Bootstrap?

Bootstrap is a front-end framework for rapid development of web applications and websites. Bootstrap is based on HTML, CSS, and JAVASCRIPT.

History

Bootstrap was developed by Mark Otto and Jacob Thornton of Twitter. Bootstrap is an open source product released on GitHub in August 2011.

Why use Bootstrap?

  • Mobile-first: As of Bootstrap 3, the framework includes mobile-first styles throughout the library.

  • Browser support: All major browsers support Bootstrap.

    Internet Explorer

  • Easy to get started: As long as you have basic knowledge of HTML and CSS, you can start learning Bootstrap.

  • Responsive design: Bootstrap’s responsive CSS adapts to desktops, tablets, and mobile phones. For more information about responsive design, see Bootstrap Responsive Design.

  • It provides a concise and unified solution for developers to create interfaces.

  • It contains powerful built-in components and is easy to customize.

  • It also offers web-based customization.

  • It is open source.

Contents of Bootstrap package

  • Basic structure: Bootstrap provides a framework with grid system, link style, The basic structure of the background. This will be explained in detail in the Bootstrap Basic Structure section.

  • CSS: Bootstrap comes with the following features: global CSS settings, defining basic HTML element styles, extensible classes, and an advanced grid system . This will be explained in detail in the Bootstrap CSS section.

  • Components: Bootstrap contains more than a dozen reusable components for creating images, drop-down menus, navigation, alert boxes, pop-up boxes, and more. This will be explained in detail in the Layout Component section.

  • JavaScript Plugins: Bootstrap includes more than a dozen custom jQuery plugins. You can include all plugins directly or include them individually. This will be explained in detail in the Bootstrap Plugin section.


  • Customization: You can customize Bootstrap’s components, LESS variables, and jQuery plugins to get your own version.



Online examples

The Bootstrap tutorial on this site contains hundreds of examples.

You can use our online editor to edit the code online and click the run button to view the results.

Example

<!DOCTYPE html>
<html>
<head>
  <title>Bootstrap 实例</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="http://apps.bdimg.com/libs/bootstrap/3.3.0/css/bootstrap.min.css">  
  <script src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script>
  <script src="http://apps.bdimg.com/libs/bootstrap/3.3.0/js/bootstrap.min.js"></script>
</head>
<body>

<div class="container">
  <div class="jumbotron">
    <h1>我的第一个 Bootstrap 页面</h1>
    <p>重置窗口大小,查看响应式效果!</p> 
  </div>
  <div class="row">
    <div class="col-sm-4">
      <h3>第一列</h3>
      <p> php中文网</p>
      <p>再牛逼的梦想,也抵不住你傻逼似的坚持!</p>
    </div>
    <div class="col-sm-4">
      <h3>第二列</h3>
      <p> php中文网</p>
      <p>再牛逼的梦想,也抵不住你傻逼似的坚持!</p>
    </div>
    <div class="col-sm-4">
      <h3>第三列</h3>        
      <p> php中文网</p>
      <p>再牛逼的梦想,也抵不住你傻逼似的坚持!</p>
    </div>
  </div>
</div>

</body>
</html>

Run instance»

Click the "Run instance" button to view the online instance


More instances

Instance

<!DOCTYPE html>
<html>
  <head>
	<meta charset="utf-8"> 
    <title>Bootstrap 实例</title>
    <!-- 包含头部信息用于适应不同设备 -->
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 包含 bootstrap 样式表 -->
    <link rel="stylesheet" href="http://apps.bdimg.com/libs/bootstrap/3.2.0/css/bootstrap.min.css">
  </head>

  <body>
    <div class="container">
      <h2>表格</h2>
      <p>创建响应式表格 (将在小于768px的小型设备下水平滚动)。另外:添加交替单元格的背景色:</p>      
      <div class="table-responsive">          
       <table class="table table-striped table-bordered">
         <thead>
           <tr>
             <th>#</th>
             <th>Name</th>
             <th>Street</th>
           </tr>
         </thead>
         <tbody>
           <tr>
             <td>1</td>
             <td>Anna Awesome</td>
             <td>Broome Street</td>
           </tr>
           <tr>
             <td>2</td>
             <td>Debbie Dallas</td>
             <td>Houston Street</td>
           </tr>
           <tr>
             <td>3</td>
             <td>John Doe</td>
             <td>Madison Street</td>
           </tr>
         </tbody>
       </table>
      </div>

      <h2>图像</h2>
      <p>创建相应式图片(将扩展到父元素)。 另外:图片以椭圆型展示:</p>            
      <img src="cinqueterre.jpg" class="img-responsive img-circle" alt="Cinque Terre" width="304" height="236"> 
      
      <h2>图标</h2>
      <p>插入图标:</p>      
      <p>云图标: <span class="glyphicon glyphicon-cloud"></span></p>      
      <p>信件图标: <span class="glyphicon glyphicon-envelope"></span></p>            
      <p>搜索图标: <span class="glyphicon glyphicon-search"></span></p>
      <p>打印图标: <span class="glyphicon glyphicon-print"></span></p>      
      <p>下载图标:<span class="glyphicon glyphicon-download"></span></p>      
    </div>

    <!-- JavaScript 放置在文档最后面可以使页面加载速度更快 -->
    <!-- 可选: 包含 jQuery 库 -->
    <script src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script>
    <!-- 可选: 合并了 Bootstrap JavaScript 插件 -->
    <script src="http://apps.bdimg.com/libs/bootstrap/3.2.0/js/bootstrap.min.js"></script>
  </body>

</html>

Run instance»

Click the "Run instance" button to view the online instance

Click "Try it" button to see how it works.