Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

CSS3 perspective property


May 06, 2021 CSS Reference Manual


Table of contents


Set the view of where the element is viewed:

div
{
perspective: 500;
-webkit-perspective: 500; /* Safari 和 Chrome */
}

Give it a try yourself

Browser support

Currently, the perspective property is not supported by the browser.

Chrome and Safari support alternative -webkit-perspective properties.

Definitions and usages

The perspective property defines the distance, in pixels, of 3D elements from the view. This property allows you to change the view of 3D elements to view 3D elements.

When you define a perspective property for an element, its children get perspective, not the element itself.

Note: The perspective property affects only 3D conversion elements.

Tip: Use the property with the perspective-origin property so that you can change the bottom position of the 3D element.

Default: none
Inheritance: yes
Version: CSS3
JavaScript syntax: object .style.perspective=500

Grammar

perspective: number|none;
Value Describe
number The distance an element is from the view, in pixels.
none The default. S ame as 0. The perspective is not set.