CSS backface-visibility Property

You are Here:

CSS backface-visibility Property

CSS backface-visibility property sets whether the back face of an element is visible when turned towards the user.

Example

HTML Online Editor
<!DOCTYPE html> <html lang="en-US"> <head> <style> div{ width: 120px; height: 120px; text-align: center; background: #66cc66; border: 1px solid #339933; animation: myAnimation 3s infinite; -webkit-animation: myAnimation 3s infinite; -moz-animation: myAnimation 3s infinite; animation-timing-function: linear; -webkit-animation-timing-function: linear; -moz-animation-timing-function: linear; } #point{ backface-visibility: visible; -webkit-backface-visibility: visible; } #point1{ backface-visibility: hidden; -webkit-backface-visibility: hidden; } @keyframes myAnimation { from {transform: rotateY(0deg);} to {transform: rotateY(360deg);} } @-moz-keyframes myAnimation /* Firefox */ { from {-moz-transform: rotateY(0deg);} to {-moz-transform: rotateY(360deg);} } @-webkit-keyframes myAnimation /* Opera, Safari, Chrome */ { from {-webkit-transform: rotateY(0deg);} to {-webkit-transform: rotateY(360deg);} } @-ms-keyframes myAnimation /* IE */ { from {-ms-transform: rotateY(0deg);} to {-ms-transform: rotateY(360deg);} } </style> </head> <body> <h1>CSS backface-visibility Property</h1> <h2>backface-visibility: visible;</h2> <div id="point">Hello World!</div> <h2>backface-visibility: hidden;</h2> <div id="point1">Hello World!</div> </body> </html>

Syntax

Using CSS

element{ backface-visibility: hidden; }

Using Javascript

object.style.backfaceVisibility="hidden";

Animatable

No, backface-visibility property is not animatable. CSS Animatable Properties Reference.

Default Value

Default value for CSS backface-visibility property is visible.

Property Value

The following table provides a list of values for CSS backface-visibility property.

ValueExplanation
visibleThe backside is visible.
hiddenThe backside is not visible.

Using JavaScript

In the following example, we will demonstrate how to change the CSS backface-visibility property of an element using JavaScript.

Example

HTML Online Editor
<!DOCTYPE html> <html lang="en-US"> <head> <style> div{ width: 120px; height: 120px; text-align: center; background: #66cc66; border: 1px solid #339933; margin-bottom: 25px; animation: myAnimation 3s infinite; -webkit-animation: myAnimation 3s infinite; -moz-animation: myAnimation 3s infinite; animation-timing-function: linear; -webkit-animation-timing-function: linear; -moz-animation-timing-function: linear; } @keyframes myAnimation { from {transform: rotateY(0deg);} to {transform: rotateY(360deg);} } @-moz-keyframes myAnimation /* Firefox */ { from {-moz-transform: rotateY(0deg);} to {-moz-transform: rotateY(360deg);} } @-webkit-keyframes myAnimation /* Opera, Safari, Chrome */ { from {-webkit-transform: rotateY(0deg);} to {-webkit-transform: rotateY(360deg);} } @-ms-keyframes myAnimation /* IE */ { from {-ms-transform: rotateY(0deg);} to {-ms-transform: rotateY(360deg);} } </style> </head> <body> <h1>CSS backface-visibility Property</h1> <h2>backface-visibility: visible;</h2> <div id="point">Hello World!</div> <button onclick="myFunction()">Click Me</button> <script> var x = document.getElementsByTagName("div")[0]; function myFunction(){ x.style.backfaceVisibility = "hidden"; x.style.WebkitBackfaceVisibility = "hidden"; } </script> </body> </html>

Reminder

Hi Developers, we almost covered 98.7% of CSS Tutorials with examples for quick and easy learning.

We are working to cover every Single Concept in CSS.

Please do google search for:

Join Our Channel

Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.

This channel is primarily useful for Full Stack Web Developer.

Share this Page

Meet the Author