Facebook PixelCSS Maths Functions | CSS Tutorial | CodeWithHarry

CSS Maths Functions

Maths functions help us in managing the dimensions of elements or screens autonomously, thus aiding in the responsiveness of a website.

Calc() Function

Calculates the value, generally the width of a particular property.

Example:

width: calc(100% - 20px);

This function will automatically subtract 20px from whatever is the 100% width of that container on the website. This way, you can space your elements well without hassles.

Max & Min Functions

These functions take two parameters and return a result based on one of them accordingly.

Example:

width: max(50px, 50%);

Out of these two, whichever is greater will be assigned as a value to the width; the opposite happens for the minimum function.