VOOZH about

URL: https://www.geeksforgeeks.org/css/css-env-function/

⇱ CSS env() Function - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

CSS env() Function

Last Updated : 30 Aug, 2024

The env() function is used to insert the value of a user agent-defined environment variable into your CSS. It is almost the same as var() in CSS except these values are user-agent-defined rather than user-defined. These variables are globally scoped. 

Syntax:

env( <custom-ident> , <declaration-value> )

Note: Please note that env() property values are case-sensitive.

Property values:

  • SAFE-AREA-INSET-TOP: It defines the top of the rectangle from the edge of the viewport.

Syntax:

env(SAFE-AREA-INSET-TOP,Integer_value)

Example: This example shows the use of the CSS env() Function.

Output:

👁 Image

  • SAFE-AREA-INSET-RIGHT: It defines the right of the rectangle from the edge of the viewport.

Syntax:

env(SAFE-AREA-INSET-RIGHT,Integer_value);

Example: This example shows the use of the CSS env() Function.

Output:

👁 Image

  • SAFE-AREA-INSET-LEFT: It defines the left of the rectangle from the edge of the viewport.

Syntax:

env(SAFE-AREA-INSET-LEFT,Integer_value);

Example: This example shows the use of the CSS env() Function.

Output:

👁 Image

  • SAFE-AREA-INSET-BOTTOM: It defines the bottom of the rectangle from the edge of the viewport.

Syntax:

env(SAFE-AREA-INSET-BOTTOM,Integer_value);

Example: This example shows the use of the CSS env() Function.

Output:

👁 Image

Supported browsers:

  • Chrome 69
  • Edge 79
  • Firefox 65
  • Safari 11.1
  • Opera 56
Comment
Article Tags: