Bootstrap 中的偏移列

bootstrapweb developmentcss framework更新于 2026/2/4 21:00:17

偏移量用于将列向前推以获得更多间距。要在大屏幕上使用偏移量,请使用 .col-md-offset-* 类。

您可以尝试运行以下代码,了解如何在 Bootstrap 中使用偏移列 −

示例

<!DOCTYPE html>
<html>
   <head>
      <title>Bootstrap Example</title>
      <link href = "/bootstrap/css/bootstrap.min.css" rel = "stylesheet">
      <script src = "/scripts/jquery.min.js"></script>
      <script src = "/bootstrap/js/bootstrap.min.js"></script>
   </head>
   <body>
      <div class = "box">
         <h1>Heading One</h1>
         <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>This is demo text. This is demo text.</p>
            </div>
         </div>
      </div>
   </body>
</html>

相关文章