css width 100 code example

Example 1: width css property

/* <length> values */
width: 300px;
width: 25em;

/* <percentage> value */
width: 75%;

/* Keyword values */
width: max-content;
width: min-content;
width: fit-content(20em);
width: auto;

/* Global values */
width: inherit;
width: initial;
width: unset;

Example 2: width css

/*Based on viewport*/
width: 100vh;
width: 100vw;

Example 3: css 100% height

<!DOCTYPE html>
<html>
  <head>
    <title>100% height</title>
    <style>
      html,
      body {
        height: 100%;
        margin: 0;
      }
      .container {
        height: 100%;
        background: #000; /* to see the effect */
      }
    </style>
  </head>
  <body>
    <div class="container"></div>
  </body>
</html>

Tags:

Css Example