Computer >> Computer tutorials >  >> Programming >> CSS

Perform calculations to determine CSS property values


Get the values of properties in CSS using the calc() property. You can try to run the following code to implement the calc() function in CSS

Example

<!DOCTYPE html>
<html>
   <head>
      <style>
         #demo {
            position: absolute;
            width: calc(100% - 100px);
            background-color: blue;
            text-align: center;
         }
      </style>
   </head>
   <body>
      <h1>Heading One</h1>
      <div id = "demo">This is it!</div>
   </body>
</html>