Horizontal scaling using vw demo

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

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

Thumbnail
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" >

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

  
</head>

<body>

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

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




</body>

</html>

/*Downloaded from https://www.codeseek.co/Zeaklous/horizontal-scaling-using-vw-demo-dOqJVB */
.container {
  width: 100vw;
  height: 100vw;
  
  /* Styling for demo purpose only */
  background-color: red;
}

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

Comments