1. css
  2. /properties
  3. /backface-visibility

backface-visibility

Definition

The backface-visibility property in CSS is used to control whether or not the backface of an element is visible when it is rotated or flipped.

Examples

Hiding the backface of an element when it is rotated:

.rotated-element {
  backface-visibility: hidden;
  transform: rotateY(180deg);
}

Showing the backface of an element when it is flipped:

.flipped-element {
  backface-visibility: visible;
  transform: scaleX(-1);
}

Hiding the backface of an element when it is animated:

.animated-element {
  backface-visibility: hidden;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

Values

ValueDescription
visibleThe backface of the element is visible.
hiddenThe backface of the element is hidden.

Best Practices

  • Use the backface-visibility property in conjunction with the transform property to control the visibility of the backface of an element when it is rotated or flipped.
  • Consider using the backface-visibility property in combination with animations to create more complex effects.
  • Avoid using the backface-visibility property on elements that are frequently updated or animated, as this can impact performance.
  • Use the backface-visibility property in combination with media queries to create responsive layouts that adapt to different screen sizes and resolutions.

Browser Compatibility

ChromeFirefoxSafariInternet ExplorerMicrosoft EdgeOpera
YesYesYesNoYesYes