Use CSS to determine whether an element is visible when not facing the screen

PHPz
Release: 2023-08-30 12:49:10
forward
1316 people have browsed it

用 CSS 确定元素在不面向屏幕时是否可见

To determine whether an element is visible when not facing the screen, use the backface-visibility attribute:

Example

Live Demonstration

<!DOCTYPE html>
<html>
<head>
   <style>
      .demo1 {
         position: relative;
         width: 150px;
         height: 150px;
         background-color: yellow;
         perspective: 80px;
         margin: 50px;
         perspective-origin: left;
         transform: rotateY(180deg);
      }
      .demo2 {
         position: absolute;
         padding: 20px;
         background-color: orange;
         transform-style: preserve-3d;
         transform: rotateX(45deg);
         backface-visibility: visible;
      }
      </style>
   </head>
   <body>
      <h1>Rotation</h1>
      <div class = "demo1">Demo
         <div class = "demo2">Demo</div>
      </div>
   </body>
</html>
Copy after login

The above is the detailed content of Use CSS to determine whether an element is visible when not facing the screen. For more information, please follow other related articles on the PHP Chinese website!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!