Bootstrap col没有占据全宽

时间:2017-11-08 07:04:27

标签: html css twitter-bootstrap

我已将col-xs-3col-xs-9用于我的2列。然而,表格似乎没有占据右侧的所有空间。我该如何解决这个问题?

enter image description here

1 个答案:

答案 0 :(得分:0)

试试这个:

<!DOCTYPE html>
<html lang="en">

<head>
  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>

<body>

  <div class="container-fluid">
    <h1>Hello World!</h1>
    <p>Resize the browser window to see the effect.</p>
    <p>The columns will automatically stack on top of each other when the screen is less than 768px wide.</p>
    <div class="row">
      <div class="col-sm-6" style="background-color:lavender;">.col-sm-4</div>
      <div class="col-sm-6" style="background-color:lavenderblush;">.col-sm-4</div>
    </div>
  </div>

</body>

</html>

当屏幕宽度小于768px时,列将自动堆叠在一起。