I have a list of components which I display like a grid, it looks like this:
So, each item is a component. The thumbnails are just background-images which I set dynamically in my html.
When hovering over them, some text appears on that box. The background image stays. Now my goal is to give that background-image some opacity. Sounds easy, but I dont know how to accomplish this and I tried already several approaches from other posts.
Here is my relevant html code:
<div
*ngIf="!isFile()"
class="image-container"
(mouseenter)="onMouseHover()"
(mouseleave)="onMouseLeave()"
(click)="onDokumentClick()"
[style.background-image]="'url(' + thumbnailPathGenerator() + ')'"
>
and thats my scss:
.image-container {
border-radius: 4px;
background-repeat: no-repeat;
background-position: center center;
box-sizing: border-box;
}
.image-container:hover {
border-radius: 4px;
box-sizing: border-box;
}
the url gets generated in the template, thats the challenge...
How can I set an opacity to my image-background?