Learn CSS Transforms by Building a Penguin - Step 4

Tell us what’s happening:

I want to understand why we use width = 100% instead of using
width = 100vw

Also why is the height = 100vh but not 100%

Your code so far

<!-- file: index.html -->
<!DOCTYPE html>
<html lang="en">
  
  <head>
    <meta charset="UTF-8" />
    <link rel="stylesheet" href="./styles.css" />
    <title>Penguin</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  </head>

  <body>
  </body>
</html>
/* file: styles.css */

/* User Editable Region */

body {
  background: linear-gradient(45deg, rgb(118, 201, 255), rgb(247, 255, 222));
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100v;
}

/* User Editable Region */

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36

Challenge Information:

Learn CSS Transforms by Building a Penguin - Step 4

Hey @aldehyde
Viewport width units are handy for creating responsive web designs because they scale with the size of the viewport . As the user resizes their browser window, elements specified in vw units will adjust their size proportionally

happy coding

@opudoprince You are right but wont % also be the same?

Maybe I have not fully understood the concept of vw and vh fully. I will recheck.

I have added a link here that may help you understand it better
https://forum.freecodecamp.org/t/what-is-the-difference-between-css-unit-vh-and-and-when-to-use-which-unit/297814

Awesome. Thank you so much.