Margin problems with thumbnails in Bootstrap
css, margins, twitter-bootstrap
Solution
I would guess that the bootstrap adds a left margin to all elements, except for the first one. You could add a style like this:
ul.thumbnails li.span4:nth-child(3n + 4) {
margin-left : 0px;
}
But be aware that this is not compatible with older ie browsers...
another way you could do it, is to add a class to every forth li in your php loop (call it something like `.noLeftMargin`, and set the css accordingly.
Problem
I'm doing this: ``` <div class="container-fluid"> <div class="row-fluid"> <div class="span12 well"> <div class="row-fluid"> <ul class="thumbnails"> <?php for($i=0; $i<count($rows); $i+=1){ // EVERY ODD BOOK STARTING AT 0 ?> <li class="span4"> <div class="thumbnail"> <img src="http://placehold.it/320x200" alt="ALT NAME"> <div class="caption"> <h3><?php echo $rows[$i]['Title']; ?></h3> <p>Seller: <?php echo $rows[$i]['FirstName'] . " " . $rows[$i]['LastName']; ?> </p> <p>Email: <?php echo $rows[$i]['Email']; ?></p> <p>Phone: <?php echo $rows[$i]['PhoneNumber']; ?></p> <p>Condition: <?php echo $rows[$i]['BookCondition']; ?></p> <p align="center"><a href="#" class="btn btn-primary btn-block">Open</a></p> </div> </div> </li> <?php } ?> </ul> </div> </div> ``` and whenever I have more than 3 items, the thumbnails get misaligned by what looks to be a left margin on the second row.. See image: