Created
January 12, 2020 01:15
-
-
Save prof3ssorSt3v3/b993f77fbe3b87c769b453e317d4b22a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge" /> | |
<title>CSS clip-path Property</title> | |
<style> | |
html { | |
font-size: 12px; | |
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, | |
Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif; | |
} | |
section { | |
background-color: #222; | |
padding: 0; | |
margin: 0; | |
width: 100%; | |
height: 400px; | |
display: flex; | |
flex-direction: row; | |
justify-content: start; | |
overflow-x: hidden; | |
} | |
section > img { | |
flex-basis: 60%; | |
object-fit: cover; | |
margin: 0; | |
position: relative; | |
clip-path: polygon( | |
20% 0%, | |
100% 0%, | |
80% 50%, | |
100% 100%, | |
20% 100%, | |
0% 50% | |
); | |
} | |
section > img:last-child { | |
margin-left: -10%; | |
} | |
/**** | |
Nav demo | |
****/ | |
nav { | |
background-color: hsl(220, 80%, 60%); | |
padding: 0; | |
margin: 1rem 0; | |
width: 100%; | |
display: flex; | |
flex-direction: row; | |
justify-content: start; | |
align-items: center; | |
} | |
nav > a { | |
background-color: hsl(220, 80%, 50%); | |
color: #fff; | |
text-decoration: none; | |
font-size: 2rem; | |
font-weight: 100; | |
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, | |
Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif; | |
line-height: 3rem; | |
padding: 0.8rem 5rem; | |
margin-left: -2rem; | |
transition: all 0.2s linear; | |
clip-path: polygon(20% 0%, 100% 0%, 80% 100%, 0% 100%); | |
} | |
nav > a:first-child { | |
margin-left: 0; | |
} | |
nav > a:active, | |
nav > a:hover, | |
nav > a:focus { | |
padding-top: 0rem; | |
border-top: 0.8rem solid #fff; | |
padding-bottom: 0rem; | |
border-bottom: 0.8rem solid #fff; | |
} | |
</style> | |
</head> | |
<body> | |
<header> | |
<h1>CSS clip-path Property</h1> | |
</header> | |
<section> | |
<img | |
src="https://picsum.photos/id/237/600/400" | |
alt="picsum photo 237" | |
/><img | |
src="https://picsum.photos/id/127/600/400" | |
alt="picsum photo 222" | |
/> | |
</section> | |
<!-- | |
clip-path: none | |
url(svg image clip path like "shape.svg#myclip") | |
margin-box | |
padding-box | |
border-box | |
content-box | |
fill-box | |
stroke-box | |
view-box | |
inset(100px 50px) | |
circle( 100px at 50px 50px) | |
ellipse(100px 200px at 20% 40%) | |
polygon(pair, pair, pair, pair, ...); | |
path("an svg path string") | |
--> | |
<nav> | |
<a href="#">Page</a> | |
<a href="#">Link</a> | |
<a href="#">Page</a> | |
<a href="#">Link</a> | |
<a href="#">Page</a> | |
</nav> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment