Open In App

CSS backface-visibility Property

The backface-visibility Property decides whether the back face of an element might be visible or not to the user. It is a mirror image of the front face that is being displayed as a back face of an element to the user. It is useful when an element is rotated then it decides whether the back face of an element is visible or not. 

Syntax:



backface-visibility: visible|hidden|initial|inherit;

Property: 

Example: In this example, we are using the backface-visibility: visible property.






<!DOCTYPE html>
<html>
 
<head>
    <title>
        CSS | backface-visibility Property
    </title>
    <style>
        div {
            position: relative;
            height: 190px;
            width: 190px;
            FONT-SIZE: 35PX;
            COLOR: WHITE;
            text-align: center;
            padding: 20px;
            background-color: GREEN;
            -webkit-transform: rotateY(180deg);
            transform: rotateY(180deg);
        }
 
        #GEEKS {
            -webkit-backface-visibility: hidden;
            backface-visibility: hidden;
        }
    </style>
</head>
 
<body>
    <center>
        <h1 style="color:green;">
            GeeksForGeeks
        </h1>
        <h2 style="color:green;">
            backface-visibility:visible;
        </h2>
        <div id="Gfg">
            Geeks For Geeks
        </div>
    </center>
</body>
 
</html>

Output:

 

Example: In this example, we are using backface-visibility: hidden property.




<!DOCTYPE html>
<html>
 
<head>
    <title>
        CSS | backface-visibility Property
    </title>
    <style>
        div {
            position: relative;
            height: 190px;
            width: 190px;
            FONT-SIZE: 35PX;
            COLOR: WHITE;
            text-align: center;
            padding: 20px;
            background-color: GREEN;
            -webkit-transform: rotateY(180deg);
            transform: rotateY(180deg);
        }
 
        #GEEKS {
            -webkit-backface-visibility: hidden;
            backface-visibility: hidden;
        }
    </style>
</head>
 
<body>
    <center>
        <h1 style="color:green;">
            GeeksForgeeks
        </h1>
        <h2 style="color:green;">
            backface-visibility:hidden;
        </h2>
        <div id="GEEKS">
            Geeks For Geeks
        </div>
    </center>
</body>
 
</html>

Output:

 

Example: In this example, we are using backface-visibility: initial property.




<!DOCTYPE html>
<html>
 
<head>
    <title>
        CSS | backface-visibility Property
    </title>
    <style>
        div {
            position: relative;
            height: 190px;
            width: 190px;
            FONT-SIZE: 35PX;
            COLOR: WHITE;
            text-align: center;
            padding: 20px;
            background-color: GREEN;
            -webkit-transform: rotateY(180deg);
            transform: rotateY(180deg);
        }
 
        #GEEKS {
            -webkit-backface-visibility: initial;
            backface-visibility: initial;
        }
    </style>
</head>
 
<body>
    <center>
        <h1 style="color:green;">
            GeeksForgeeks
        </h1>
        <h2 style="color:green;">
            backface-visibility:initial;
        </h2>
        <div id="GEEKS">
            Geeks For Geeks
        </div>
    </center>
</body>
 
</html>

Output:

 

Supported browser: The browser supported by backface-visibility Property are listed below:


Article Tags :