As commented, and:
- A row is used to group elements together within a container. The word row is slightly stupid, since it doesn't enforce rows. It's really about the grouping
- Bootstrap will automatically fill the "row" (or container/parent element) untill it's over 12 cols, where each col uses 1/12 of the width (taking gutter and spacing with it)
- A div/html element that has display:block; wil automatically start on a new line. (Use inline-block or floats for that) You will notice bootstrap is completely floated
Taking the above I suggest the following code, where the container should be the box all the images are in. I'd like to add in col-xs-12 to ensure mobile visibility (1 per "row").
Please use the following CSS selector to target your images
.myImgs > div { // All direct descendants of myImgs }
.myImgs img { // All images within myImgs }
or
.myImgs > div > img { // Extremely specific }
-
<script type="text/template" id="image-template">
<div class="container myImgs">
<% _.each(images, function(image){%>
<div class="col-xs-12 col-md-4">
<img src="<%=image.imgsrc%>" class="img-thumbnail"/>
</div>
<% }); %>
</div>
</script>
If you really need the row, try to get a counter within the loop. (1 on first pass, 2on second, 3 on third etc.) U can work with conditons there: If (number%3 === 0) {end row + new row}. Open and close the row as well before and after the loop.
% is called modulus, and gives the remainder/offset. So only valid multiplication of 3 will return 0 (3, 6, 9 etc). Small note: 0%3 = 0