css - Using image in angular -
i have images stored in images folder inside assets folder
app -app.component.css assets -images -some-image.png
i'm trying image in css inside background-image, think have path related issues, since can't seem bring image.
background-image: url(../../../assets/images/some-image.png) no-repeat center top;
help appreciated.
try adding style following width , height. also, isolate background-repeat , background-position. it'd work.
background-image: url(../assets/images/some-image.png); background-repeat: no-repeat; background-position: center-top; width: 100%; // width height: 230px; // height
to make better can add,
background-size: contain;
update:
the reason image doesn't show without width , height, default div given height of 0 since there no inner elements. but, has default width of 100% already. therefore, when add image using css background image property, we've add height attribute.
Comments
Post a Comment