Open In App

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

Improve
Improve
Like Article
Like
Save
Share
Report

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


Last Updated : 14 Oct, 2020
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads