Beispiel:CSS-mask-2.html
Aus SELFHTML-Wiki
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" media="screen" href="./Beispiel:SELFHTML-Beispiel-Grundlayout.css">
<title>CSS-mask - 2</title>
<style>
.icon {
-webkit-mask-image: url(https://wiki.selfhtml.org/images/1/1c/Cloud.svg);
-webkit-mask-size: contain;
-webkit-mask-repeat: no-repeat;
mask-image: url(https://wiki.selfhtml.org/images/1/1c/Cloud.svg);
mask-size: contain;
mask-repeat: no-repeat;
width: 200px;
height: 200px;
}
.blue {
background-color: steelBlue;
}
.red{
background-color: #c82f04;
mask-size: 50%;
mask-position: center top;
}
img {
width: 200px;
height: 200px;
}
#galerie {
display:grid;
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));;
gap: 1em;
padding: 0;
}
figure {
width: 100%;
border: thin dotted steelBlue;
}
</style>
</head>
<body>
<div id="galerie">
<figure>
<img src="https://wiki.selfhtml.org/images/1/1c/Cloud.svg" alt="Wolke" >
<figcaption>Grafik, die als Maske dienen soll</figcaption>
</figure>
<figure>
<div class="icon blue"></div>
<figcaption>Icon in Blau</figcaption>
</figure>
<figure>
<div class="icon red"></div>
<figcaption>Icon in Rot</figcaption>
</figure>
</div>
</body>
</html>