Beispiel:CSS3 clip-path-2.html
Aus SELFHTML-Wiki
<!DOCTYPE html>
<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>clip-path</title>
<style>
main::after { clear: left; content: " "; display: block; }
figure {
position: relative;
width: 250px;
height: 333px;
margin: 10px;
float: left;
}
.clip-poly {
/* unregelmäßige Form */
-webkit-clip-path: url("#clipPolygon");
clip-path: url("#clipPolygon");
}
img:hover {
-webkit-clip-path: none;
clip-path: none;
}
/* Reset Grundlayout bezüglich SVG-Elementen */
svg { border: none !important; }
</style>
</head>
<body>
<h1>Inhalte mit <code>clip-path</code> beschneiden</h1>
<main>
<p>
<figure>
<img class="clip-poly" src="/images/4/4d/Celsius.jpg" alt="Anders Celsius" title="Anders Celsius">
</figure>
</p>
<svg width="0" height="0">
<clipPath id="clipPolygon">
<polygon points="75 150,0 150,60 203,26 288,120 248,206 298,177 211,239 150,158 150,122 36,77 150">
</polygon>
</clipPath>
</svg>
</main>
</body>
</html>