2017-04-10 106 views
0

我正在嘗試使用卡創建一個簡單的網格。我正在使用ng-repeat來創建卡片。問題是,有如圖引導程序中卡的間距問題

enter image description here

我使用下面的代碼

<!DOCTYPE html> 
 
<html lang="en" ng-app="movieflix"> 
 
<head> 
 
    <meta name="viewport" content="width=device-width, initial-scale=1.0"> 
 
    <meta charset="UTF-8"> 
 
    <title>Title</title> 
 
</head> 
 
<body> 
 
<div class="container" ng-controller="catalogcontroller"> 
 
    <div class="row" > 
 

 
     <div dir-paginate="user in users|itemsPerPage:16"> 
 

 
      <div class="col-xs-6 col-sm-3 col-md-3"> 
 
      <div class="card card-block "> 
 
       <!--Card image--> 
 
       <div class="view overlay hm-white-slight"> 
 
       <img src="http://ia.media-imdb.com/images/M/[email protected]_V1_SX300.jpg", class="img-fluid" alt=""> 
 
       <a> 
 
        <div class="mask waves-effect waves-light"></div> 
 
       </a> 
 
       </div> 
 
       <!--/.Card image--> 
 
       <!--Card content--> 
 
       <div class="card-block"> 
 
       <!--Social shares button--> 
 
       <!--Title--> 
 
       <h4 class="card-title">Card title</h4> 
 
       <hr> 
 
       <!--Text--> 
 
       <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p> 
 
       <a href="#" class="d-flex flex-row-reverse"> 
 
        <h5 class="waves-effect waves-light p-2">Read more <i class="fa fa-chevron-right"></i> 
 
        </h5> 
 
       </a> 
 
       </div> 
 
       <!--/.Card content--> 
 
      </div> 
 
      </div> 
 

 
     </div> 
 
     </div> 
 
    <dir-pagination-controls 
 
      max-size="5" 
 
      direction-links="false" 
 
      boundary-links="false" > 
 
    </dir-pagination-controls> 
 

 
</div> 
 

 
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script> 
 
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" /> 
 
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> 
 
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.8/angular.min.js"></script> 
 

 
<script src="js/dirPagination.js"></script> 
 
<script src="js/movieflix.module.js"></script> 
 
<script src="js/catalog.controller.js"></script> 
 
</body> 
 
</html>
各卡之間沒有間隔

誰能告訴我什麼是錯的我的代碼。

真的很感謝任何建議。

提前感謝卡之間

+1

'card'是Bootstrap 3.3.7的一個特性嗎?我無法在文檔中找到它。我只知道來自Bootstrap 4.alpha的'card'。 –

回答

1

card類工作得很好。你的圖片太寬了。將您的圖片類從img-fluid更改爲img-responsive,它應該可以工作。 至少它在this fiddle上。

+0

非常感謝。 img-responsive做了這個訣竅。現在工作正常。 – dharan

1

添加空間:

.card { 
    margin-right: 10px; 
} 

.card:last-of-type { 
    margin-right: 0; 
} 
+0

嗨Stefan,謝謝你的建議。我試過你的代碼,但它不工作。 – dharan