Skip to content

Instantly share code, notes, and snippets.

@wesbos
Created April 5, 2019 13:32
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wesbos/e23829c804ba7d46d4d78a0cb3ff4662 to your computer and use it in GitHub Desktop.
Save wesbos/e23829c804ba7d46d4d78a0cb3ff4662 to your computer and use it in GitHub Desktop.
cool headings
<h1>Cool text</h1>
const headings = document.querySelectorAll('h1,h2,h3,h4,h5,h6');
let styles = ``;
headings.forEach(heading => {
console.log(heading);
const rando = `x${Math.floor(Math.random() * 16777215).toString(16)}`;
heading.classList.add(rando);
const text = heading.textContent.replace(`'`, `\\'`);
styles += `.${rando}:after { content: '${text}';}`;
});
const style = document.createElement('style');
style.textContent = styles;
document.body.appendChild(style);
h1,h2,h3,h4,h5,h6
color alpha(red, 0.8)
font-weight normal
line-height: 0.8
letter-spacing -2px;
line-height auto
text-shadow 6px 6px 1px alpha(black, 0.05)
font-family: 'Bevan', sans-serif;
font-family: 'Carter One', sans-serif;
position relative
text-align center
&:after
position: absolute
left 0
top 0
color yellow
z-index: -1
transform skew(-2deg) translateX(-20px)
font-style italic
text-shadow none
width: 100%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment