Answers for "css set height to width"

2

css keep image ratio

img {
  object-fit: cover;
  width: 100px;
  height:100px;
}
Posted by: Guest on November-03-2020
0

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>
Posted by: Guest on June-13-2020
1

set height to width css

example {
  height: 100px;
  width: 100px;
  background-color: blue;
}
Posted by: Guest on September-13-2021

Browse Popular Code Answers by Language