Horizontal scaling demo

In this example below you will see how to do a Horizontal scaling demo with some HTML / CSS and Javascript

A demo of how to proportionally scale an element based on the parent's width for a CSS-Tricks post.

This awesome code was written by Zach Saucier, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright Zach Saucier ©
  • HTML
  • CSS
  • JavaScript
<!DOCTYPE html>
<html lang="en" >

  <meta charset="UTF-8">
  <title>Horizontal scaling demo</title>
      <link rel="stylesheet" href="css/style.css">



  <div class="container"></div>

    <script  src="js/index.js"></script>



/*Downloaded from https://www.codeseek.co/Zeaklous/horizontal-scaling-demo-zoJqRG */
.container {
  height: 0;
  padding-top: 100%;
  /* Styling for demo purpose only */
  background-color: red;

/*Downloaded from https://www.codeseek.co/Zeaklous/horizontal-scaling-demo-zoJqRG */
// For more check out zachsaucier.com