Skip to content
Related Articles

Related Articles

Save Article
Improve Article
Save Article
Like Article

CSS | calc() Function

  • Last Updated : 30 Jul, 2021

The calc() function is an inbuilt function in CSS which is used to perform calculations based on CSS property.

calc( Expression )

Parameters: This function accepts single parameter Expression which is mandatory. This parameter contains mathematical expression which need to implement. The operators used by this parameters are: +, -, *, /
Below program illustrates the calc() function in CSS:

Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.


<!DOCTYPE html>
        <title>calc function</title>
            .geeks {
                position: absolute;
                left: 50px;
                width: calc(100% - 20%);
                height:calc(500px - 300px);
                background-color: green;
                text-align: center;
            .gfg {
            h1 {
        <div class = "geeks">
            <div class = "gfg">GeeksforGeeks</div>
            <h1>The calc() Function</h1>


Supported Browser:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Opera
  • Safari

My Personal Notes arrow_drop_up
Recommended Articles
Page :