2016-12-29 73 views
3

我想把一些圖像放到我的背景div中。 我預計這5個圖像文件將在「.well」類的div中,但他們只是分散在該div中。所以,這是我的問題。
如何將這些圖像文件穩定地放入.well div? 有我的代碼,並導致如下:問:AngularJS,我怎樣才能把圖像放到我的背景div中?

<!doctype html> 
 
<html ng-app="exampleApp"> 
 
\t <head> 
 
\t \t <script src="angular.js"></script> 
 
\t \t <link href="bootstrap.css" rel="stylesheet"></link> 
 
\t \t <link href="bootstrap-theme.css" rel="stylesheet"></link> 
 
\t \t <script> 
 
\t \t \t angular.module("exampleApp", []) 
 
\t \t \t .controller("exampleCtrl", function($scope){ 
 
\t 
 
\t \t \t $scope.data = [ 
 
\t \t \t \t { movie:"Pandora", date:"2016-12-07", img:"pandora.gif" }, 
 
\t \t \t \t { movie:"Lalaland", date:"2016-12-07", img:"lalaland.gif" }, 
 
\t \t \t \t { movie:"Willyoubethere", date:"2016-12-14", img:"willYouBeThere.gif" }, 
 
\t \t \t \t { movie:"brother", date:"2016-11-23", img:"brother.gif" }, 
 
\t \t \t \t { movie:"Animal", date:"2016-11-16", img:"fantasticAnimalDictionary.gif" } 
 
\t \t \t ]; 
 
\t \t \t }); 
 
\t \t </script> 
 
\t </head> 
 
\t <body ng-controller="exampleCtrl"> 
 
\t \t <div class="container"> 
 
\t \t \t <div class="well"> 
 
\t \t \t \t <div class="col-md-2" ng-repeat="data in data"> 
 
\t \t \t \t \t <img ng-src={{data.img}} /> 
 
\t \t \t \t </div> 
 
\t \t \t </div> 
 
\t \t </div> 
 
\t </body> 
 
</html>

The result from my code

+1

我們可以看到「好」的class css嗎? –

+0

我們可以幫助,如果你證明了井類的好處 –

回答

1

添加rowwell。這樣

<div class="well row"> 
    <div class="col-md-2" ng-repeat="data in data"> 
     <img ng-src={{data.img}} /> 
    </div> 
</div> 

row類是columns.The行的容器提供了列有地方住,有理想,加起來12列它還作爲一個包裝,因爲所有的列左浮動,其他行當漂浮物變得怪異時不會有重疊。

+0

真棒。它工作得很好。 'row'函數在這種情況下做了什麼? – moon

+0

並且非常感謝。 – moon

+0

我更新了答案。請檢查。 – Ahmar

相關問題