AllramEst
AllramEst

Reputation: 1449

cards lose their position when on new line in ng-repeat (AngularJS)

I am looping thru items with ng-repeat. Here is the code:

<div class="row"
<div class="w3-card-3 col-xs-18 col-sm-6 col-md-3" ng-repeat="p in products">
    <div class="thumbnail">
        <img ng-src="{{p.img}}" alt="...">
        <div class="caption">
            <h4 class="text-danger">{{p.brand}}</h4>
            <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Facere, soluta, eligendi doloribus sunt minus amet sit debitis repellat. Consectetur, culpa itaque odio similique suscipit</p>

            <a  href="car/{{ p.id }}"  class="btn btn-default btn-xs pull-right" role="button"><i class="glyphicon glyphicon-edit"></i>
            </a> <a href="#" class="btn btn-info btn-xs" role="button">Info</a>

            <a href="#" class="btn btn-default btn-xs" role="button">Bid</a>
        </div>
    </div>
</div>

My problem is that when the repeater enters a new line the cards generated gets messed up. Here's an image of the problem:

enter image description here

What's wrong with my code? Why won't the cards align underneath each other. Tell me if there is anything else you want to see.

Upvotes: 0

Views: 32

Answers (2)

Anil Shrestha
Anil Shrestha

Reputation: 1200

use height of image and description wrapper it should solve the problem

Upvotes: 1

Faly
Faly

Reputation: 13356

Try to add style="float: left" in the div below:

<div class="thumbnail" style="float: left">

Upvotes: 0

Related Questions