Skip to content

Instantly share code, notes, and snippets.

View Eskuero's full-sized avatar

Óliver García Albertos Eskuero

View GitHub Profile
@Eskuero
Eskuero / index.html
Created August 10, 2021 18:10 — forked from lyudmil-mitev/index.html
CSS Transform Scale element to fit its parent
<html>
<head>
<title>CSS Transform Scale element to fit its parent</title>
<script src="scale2fit.js"></script>
<link rel="stylesheet" href="style.css"/>
<script>
(function(window) {
function main() {
const margin = 10;
requestAnimationFrame(function fitToParentOnResize() {