<p>[Press any key]</p>
body {
padding: 20px;
font-weight: bold;
font-size: 5em;
text-align: center;
}
// Press any key and the result will display on the page.
// Make sure your cursor is focused in the preview window first.
window.addEventListener('keydown', function (e) {
document.querySelector('p').innerHTML = `You pressed ${e.key}`;
}, false);
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.