CSS Property Value How to - Make compound styles by calc








Question

We would like to know how to make compound styles by calc.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
html, body {<!--   ww  w .jav  a  2s .c  om-->
  height: 100%;
}

div {
  width: 100%;
  height: calc(100% - 10px);
  background: red;
}
</style>
</head>
<body>
  <div></div>
</body>
</html>

The code above is rendered as follows: