CSS | backface-visibility Property

This 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:

  • visible: It is the default value. The back face of an element is visible when facing the user.

    Syntax:

    backface-visibility:visible;:

    Example:

    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

    <!DOCTYPE html>
    <html>
        <head>
            <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>                    

    chevron_right

    
    

    Output:

  • hidden: This property values specifies the back face of an element is hidden when facing the user.

    Syntax:

    backface-visibility:hidden;

    Example:

    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

    <!DOCTYPE html>
    <html>
        <head>
            <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>                    

    chevron_right

    
    

    Output:

  • initial: It sets the property to its default value.

    Syntax:

    backface-visibility:initial;

    Example:

    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

    <!DOCTYPE html>
    <html>
        <head>
            <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>                    

    chevron_right

    
    

    Output:



    My Personal Notes arrow_drop_up

    Check out this Author's contributed articles.

    If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

    Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.