Skip to content

Instantly share code, notes, and snippets.

@navin-moorthy
Last active January 1, 2020 12:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save navin-moorthy/6da3adc8b039e3c70131018591f00d62 to your computer and use it in GitHub Desktop.
Save navin-moorthy/6da3adc8b039e3c70131018591f00d62 to your computer and use it in GitHub Desktop.
CloneCSS-His Dark Materials Font Split
<h1 style="--text: 'His Dark Materials';"><span>His</span> Dark Materials</h1>
{
"scripts": [],
"styles": []
}
@import url('https://fonts.googleapis.com/css?family=Josefin+Sans:400,700&display=swap');
* {
box-sizing: border-box;
--low: 20%;
--high: 80%;
--gap: 0.9rem;
--offset: calc(var(--gap) / 2);
}
body {
background: black;
color: white;
display: grid;
place-items: center;
height: 100vh;
}
h1 {
text-align: center;
font-family: 'Josefin Sans';
font-size: 3rem;
line-height: 1;
text-transform: uppercase;
position: relative;
max-width: 30rem;
color: transparent;
}
@media (min-width: 40rem) {
h1 {
font-size: 5rem;
}
}
h1 span {
color: white;
font-weight: 700;
letter-spacing: -0.03em;
}
h1::before,
h1::after {
content: var(--text);
position: absolute;
top: 0;
left: 0;
width: 100%;
text-align: center;
color: white;
z-index: -1;
}
h1::before {
font-weight: 700;
letter-spacing: -0.03em;
--clip1: polygon(calc(var(--high) + var(--offset)) 0, 100% 0, 100% 100%, calc(var(--low) + var(--offset)) 100%);
clip-path: var(--clip1);
}
h1::after {
font-weight: 400;
--clip2: polygon(calc(var(--high) - var(--offset)) 0, calc(var(--low) - var(--offset)) 100%, 0 100%, 0 0);
clip-path: var(--clip2);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment