Skip to content

Instantly share code, notes, and snippets.

@vanaf1979
Created December 16, 2020 08:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save vanaf1979/b8c511e1ef1b638c310ce3d77beddd46 to your computer and use it in GitHub Desktop.
Save vanaf1979/b8c511e1ef1b638c310ce3d77beddd46 to your computer and use it in GitHub Desktop.
<!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