Bootstrap shift div和对齐内容

时间:2018-02-26 09:20:29

标签: html css twitter-bootstrap alignment


我的网站模板有些麻烦。是否可以移动div(或容器)并使内容与页面上的其他内容保持一致?我可以用经典的HTML + CSS做到这一点但是在引导程序方面有一些麻烦。 见图。

documentation

1 个答案:

答案 0 :(得分:-1)

<!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.3.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-xs-4 col-xs-offset-2" style="background-color:lavender;">.col-sm-4</div>
    <div class="col-xs-4" style="background-color:lavenderblush;">.col-sm-8</div>
  </div>
</div>

</body>
</html>