一、栅格和块阴影
<!DOCTYPE html> <html> <head> <title>Bootstrap 实例 - 堆叠的水平</title> <link href="http://libs.baidu.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet"> <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script> <script src="http://libs.baidu.com/bootstrap/3.0.3/js/bootstrap.min.js"></script> </head> <body> <div class="container"> <h1>Hello, world!</h1> <div class="row"> <div class="col-md-6" style="background-color: #dedef8; box-shadow: inset 5px -5px 5px #444, inset -5px 5px 5px #444;"> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. </p> <p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. </p> </div> <div class="col-md-6" style="background-color: #dedef8;box-shadow: inset 1px -1px 1px #444,inset -10px 10px 10px #0000ff;"> <p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium. </p> <p> Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. </p> </div> </div> </body> </html>
box-shadow: inset 5px -5px 5px #444, inset -5px 5px 5px #444;
阴影向内,不写inset,默认阴影向外,后面四个参数依次为:左、下、向内扩散大小,阴影颜色;后一组参数依次为:阴影向内、右、上、向内扩散大小、阴影颜色;
<div class="col-sm-3 col-md-6 col-lg-4">....</div> <div class="col-sm-9 col-md-6 col-lg-8">....</div>
提供了 3 种不同的列布局,分别适用于三种设备。在手机上,它将是左边 25% 右边 75% 的布局。在平板电脑上,它将是 50%/50% 的布局。在大型视口的设备上,它将是 33%/66% 的布局。
响应式的列重置
<div class="col-xs-6 col-sm-3"></div> <div class="col-xs-6 col-sm-3"> </div> <div class="clearfix visible-xs"></div> <div class="col-xs-6 col-sm-3"></div> <div class="col-xs-6 col-sm-3"></div>
偏移列
<div class="row" > <div class="col-xs-6 col-md-offset-3" style="background-color: #dedef8;box-shadow: inset 1px -1px 1px #444, inset -1px 1px 1px #444;"> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. </p> </div> </div>
嵌套列
<div class="container"> <h1>Hello, world!</h1> <div class="row"> <div class="col-md-3"> <h4>第一列</h4> </div> <div class="col-md-9"> <h4>第二列 - 分为四个盒子</h4> <div class="row"> <div class="col-md-6"></div> <div class="col-md-6"></div> </div> <div class="row"> <div class="col-md-6"></div> <div class="col-md-6"></div> </div> </div> </div> </div>
列排序
<div class="row"> <p>排序后</p> <div class="col-md-4 col-md-push-8"> 我在左边 </div> <div class="col-md-8 col-md-pull-4"> 我在右边 </div> </div>
时间: 2024-10-26 09:26:33