Skip to content

Instantly share code, notes, and snippets.

@9kopb
Created October 7, 2017 04:23
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 9kopb/3aa6607ec01d3b8a79ba33299911d2ea to your computer and use it in GitHub Desktop.
Save 9kopb/3aa6607ec01d3b8a79ba33299911d2ea to your computer and use it in GitHub Desktop.
Basic Keycode Finder
<h1>A</h1>
<p>keycode<br><span>65</span></p>
function keyCode(e) {
var keycodeContainer = document.getElementsByTagName('span')[0];
var keyContainer = document.getElementsByTagName('h1')[0];
keycodeContainer.innerHTML = e.keyCode;
keyContainer.innerHTML = e.key
}
window.addEventListener('keydown', keyCode);
@import url('https://fonts.googleapis.com/css?family=Inconsolata|Noto+Serif:700i');
body {
display: flex;
justify-content: center;
align-items: center;
flex-flow: column wrap;
min-height: 100vh;
font-family: 'Inconsolata', monospace;
background-color: #191919;
color: white;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
background-image: linear-gradient(rgba(0,0,0,0.85), rgba(0,0,0,0.95)), url('https://source.unsplash.com/1920x1080/?letterpress,typography,letter,type,font,fonts,');
background-size: cover;
background-position: center center;
}
h1 {
font-size: 9rem;
line-height: 1em;
font-family: 'Noto Serif', serif;
margin: 0 0 1rem;
font-style: italic;
}
p {
font-size: 1rem;
text-align: center;
}
span {
font-size: 2rem;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment