Skip to content

Instantly share code, notes, and snippets.

@bclinkinbeard
Last active July 15, 2016 14:04
Show Gist options
  • Select an option

  • Save bclinkinbeard/c45ef0f77687756ac8f17ea8db992f74 to your computer and use it in GitHub Desktop.

Select an option

Save bclinkinbeard/c45ef0f77687756ac8f17ea8db992f74 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
body {
margin: 0;
}
div {
display: flex;
justify-content: center;
align-items: center;
width: 100%;
height: 100vh;
background-color: lightgreen;
border: 5px solid darkolivegreen;
box-sizing: border-box;
}
</style>
</head>
<body>
<div>
<h1>Hello</h1>
</div>
<script>
function handleResize () {
document
.querySelector('h1')
.textContent = window.innerWidth + 'x' + window.innerHeight;
}
window.onresize = handleResize;
handleResize();
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment