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

34 views Asked by At

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.

2

There are 2 answers

2
Anil Shrestha On BEST ANSWER

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

1
Faly On

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

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