css - angular, background image and background position -
i'm struggling add additional background
styles using ng-style
. idea of trying make grid of speakers using ng-repeat
, each grid element having it's own image of speaker. fine, except want images background
, , while can image reflect can't add css background-position
& background-size
. basics of doing here, issue i've tried using inline styles unsuccessfully:
code:
<div class="grid" ng-repeat="speaker in home.speakers"> <div class="grid-image" ng-style="{'background':'url({{speaker.img}})' 'center center' '/' 'cover'}"></div> <span class="caption"><h3>{{speaker.name}}</h3></span> </div>
i've played single quotes every imaginable way, still console error has no idea trying do. i've tried setting background size
, background position
in separate class, doesn't work because image isn't declared it. @ loss here, though assume wouldn't first try this, i'm finding nothing helpful on it.
because using background-image
, applying shorthand background
, here:
ng-style="{'background-image':'url({{speaker.img}})' 'center center' '/' 'cover'}">
change to:
ng-style="{'background-image':'url({{speaker.img}})', 'background-position': 'center center', 'background-size': 'cover'}">
Comments
Post a Comment