Beispiel:CSS-mask-1.html

Aus SELFHTML-Wiki
Wechseln zu: Navigation, Suche
<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 - 1</title>
<style>
.wolke {
	-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;
}
img:hover {
	-webkit-mask: none;
	mask: none;
}

img {
	width: 200px;
	height: 266px;
	margin-bottom: 1em;
}

#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/mediawiki/images/4/4d/Celsius.jpg" alt="Anders Celsius" >
		<figcaption>Originalbild</figcaption>
	</figure>
	<figure>
		<img src="https://wiki.selfhtml.org/images/1/1c/Cloud.svg" alt="Wolke" >
		<figcaption>Grafik, die als Maske dienen soll</figcaption>
	</figure>
	<figure>
		<img class="wolke" src="https://wiki.selfhtml.org/mediawiki/images/4/4d/Celsius.jpg" alt="Anders Celsius">
		<figcaption>Maskiertes Bild</figcaption>
	</figure>
</div>		

<p>Hovern Sie über das Bild, um das gesamte Bild zu sehen (<code>mask:none</code>).</p>
</body>
</html>