Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Clip-path triangle</title>
</head>
<body>
<div class="path"></div>
<style>
body {
display: flex;
align-items: center;
justify-content: center;
min-height: 100vh;
background-color: #111111;
}
.path {
width: 200px;
height: 150px;
background: green;
/* Use clip path to create a mask */
/* cords: center-top, right-bottom, left-bottom */
clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
}
</style>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment