简单教程
提交运行
代码编辑器:
<!DOCTYPE htm> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"> <script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.js"></script> <script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> <style>body {margin:20px}</style> <div class="container-fluid"> <h1>Hello World!</h1> <div class="row"> <div class="col-xs-6 col-sm-3" style="background-color:lavender;"> 列 1<br> 重置窗口大小,查看效果。也尝试删除有 clearfix 的 div 查看效果。 </div> <div class="col-xs-6 col-sm-3" style="background-color:lavenderblush;">列 2</div> <!-- Add clearfix for only the required viewport --> <div class="clearfix visible-xs"></div> <div class="col-xs-6 col-sm-3" style="background-color:lightcyan;">列 3</div> <div class="col-xs-6 col-sm-3" style="background-color:lightgray;">列 4</div> </div> </div>
运行结果: