Skip to content
Related Articles

Related Articles

How to hide/visible the backside of a rotated div element using CSS ?

View Discussion
Improve Article
Save Article
Like Article
  • Last Updated : 14 Oct, 2020

The approach of this article is whether to show or hide the backside of an element when it is rotated by using backface-visibility Property in CSS. 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;

Example: Below code uses to show the backside of the 180 deg rotated <div> Element.




<!DOCTYPE html>
<html>
  
<head>
    <style>
        div {
            position: relative;
            height: 60px;
            width: 210px;
            font-size: 35PX;
            color: white;
            text-align: center;
            padding: 20px;
            background-color: blue;
            -webkit-transform: rotateY(180deg);
            transform: rotateY(180deg);
        }
  
        #GFG {
            -webkit-backface-visibility: visible
        }
    </style>
</head>
  
<body>
    <center>
        <h1 style="color:green;">GeeksForGeeks</h1>
        <h2 style="color:green;">
            How to visible or hide the backside
            of a rotated division element?
        </h2>
        <div id="GFG">GeeksForGeeks</div>
    </center>
</body>
  
</html>        

Output:

Example 2:




<!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>    

Output:

Supported Browsers:

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


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!