网格系统 - 移动设备、平板电脑、桌面电脑



我们已经看到了中型和大型设备的一个示例。现在让我们更进一步,我们希望为超小型手机尺寸也进行更改。假设我们想要为平板电脑添加将列分成 75%/25% 的选项,我们可以这样做:

<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 种不同的列布局。在手机上,左侧将是 75%,右侧将是 25%。在平板电脑上,它将再次是 50%/50%,在大型视口中,它将是 33%/66%。三种不同尺寸的响应式布局。在以下示例中查看它。(此处使用了每列的样式。您可以避免它。)

<div class = "container">
   <h1>Hello, world!</h1>

   <div class = "row">
      <div class = "col-sm-3 col-md-6 col-lg-8" 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, 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-sm-9 col-md-6 col-lg-4" style = "background-color: #dedef8;
         box-shadow: inset 1px -1px 1px #444, inset -1px 1px 1px #444;">
         
         <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>
</div>

这将产生以下结果:

bootstrap_grid_system.htm
广告