如何使用bootstrap正确创建blockquote

时间:2018-03-17 14:31:44

标签: javascript css bootstrap-4

  

我有以下代码。   使用最新的bootstrap版本

 <!DOCTYPE html>
<html>
<head>
  <title>Bootstrap Grid System</title>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" />
  <link href="CustomStyle.css" rel="stylesheet" />
</head>
<body>
  <div class="container">
    <div class="row">
      <blockquote>
        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
        <footer>Someone famous in <cite title="Source Title">Source Title</cite></footer>
      </blockquote>
    </div>
  </div>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
  <script src="bootstrap/js/bootstrap.min.js"></script>
</body>
</html>
  

并期待以下结果 -     enter image description here

     

但它产生了这个结果     enter image description here

     

那么代码有什么问题?

2 个答案:

答案 0 :(得分:0)

您需要使用blockquote可用的bootstrap-4类。

<!DOCTYPE html>
<html>
<head>
  <title>Bootstrap Grid System</title>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
</head>
<body>
  <div class="container">
    <div class="row">
      <blockquote class="blockquote text-right">
        <p class="mb-0">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
        <footer  class="blockquote-footer">Someone famous in <cite title="Source Title">Source Title</cite></footer>
      </blockquote>
    </div>
  </div>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
  <script src="bootstrap/js/bootstrap.min.js"></script>
</body>
</html>

答案 1 :(得分:0)

试试这个你想要的一样。

.blockquote-box {
  border-right: 5px solid #E6E6E6;
  margin-bottom: 25px;
  float:right;
}

.margin-right{
  margin-right:15px;
  font-size:15px
}

.text-weight{
  float:right;
  margin-right:15px;
  opacity: 0.5;
  font-size:12px;
}
<link href="//netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//netdna.bootstrapcdn.com/bootstrap/3.1.0/js/bootstrap.min.js"></script>

<div class="container">
  <div class="row">
    <div class="col-md-6">
      <div class="blockquote-box clearfix">
        <h4 class = "margin-right">
          Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</h4>
        <p class = "text-weight">
          Someone famous in source title ---
        </p>
      </div>
    </div>
  </div>
</div>