Skip to content

Commit

Permalink
Add index.html with viewport resolution functionality
Browse files Browse the repository at this point in the history
jcornellasg committed Feb 21, 2024
0 parents commit 56587a7
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Resolución del Viewport</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 20px;
text-align: center;
}
#resolution {
font-size: 24px;
margin-top: 50px;
}
</style>
</head>
<body>
<h1>Resolución del Viewport</h1>
<p>La resolución actual del viewport es:</p>
<div id="resolution"></div>

<script>
function updateResolution() {
const resolutionElement = document.getElementById('resolution');
const resolution = window.innerWidth + 'x' + window.innerHeight;
resolutionElement.textContent = resolution;
}

window.addEventListener('DOMContentLoaded', updateResolution);
window.addEventListener('resize', updateResolution);
</script>
</body>
</html>

0 comments on commit 56587a7

Please sign in to comment.