html - Grid layout of divs in angular2 -
i have view in application display thumbnails in grid layout. when create divs no content appear desired:
when add content divs, layout goes haywire:
i can't figure out why happening.
i'm using *ngfor directive angular2:
<div class="board-thumbnail-container" *ngfor="let board of boards"> <img class="board-thumbnail" [src]="getboardimage(board)"> <h3><span>{{board}}</span></h3> </div>
and css behind it:
.container { width:400px; } .board-thumbnail-container { position: relative; width: 174px; height: 174px; margin-right: 5px; margin-bottom: 5px; display: inline-block; border-style: solid; border-color: lightblue; border-radius: 7px; padding: 5px; text-align: center; } .board-thumbnail { position: relative; max-width: 160px; max-height: 160px; } .board-thumbnail-container > h3 { position: absolute; bottom: 0px; left: 0; width: 100%; } .board-thumbnail-container > h3 > span { color: white; letter-spacing: -1px; background: rgb(0, 0, 0); /* fallback color */ background: rgba(0, 0, 0, 0.7); padding: 0px 5px 0px 5px; }
here plunker exhibiting problem: http://plnkr.co/edit/trl8mj7wuzyegrgzy5ya?p=preview
it working when gave vertical-align: top
.board-thumbnail-container
. check http://plnkr.co/edit/hiiqrroahsmgggfwcnox?p=preview