A Pen by Steven Roberts on CodePen.
Created
October 7, 2017 04:23
-
-
Save 9kopb/3aa6607ec01d3b8a79ba33299911d2ea to your computer and use it in GitHub Desktop.
Basic Keycode Finder
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
<h1>A</h1> | |
<p>keycode<br><span>65</span></p> |
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
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); |
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
@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