Transform 属性会导致子元素的 fixed 属性失效

作者:袖梨 2022-06-25



 

效果


 

  

   

  

  

   

  

 

 

代码


 

HTML结构


 

  
<div class="notransform">
 <div class="fixed"></div>
</div>
<div class="transform">
 <div class="fixed"></div>
</div>

 

 

CSS代码


 

  
.fixed{position: fixed;top:10px;left:10px;width:50px;height:50px;background: blue;}
.notransform{width:200px;height:200px;background: red;}
.transform{width:200px;height:200px;background: green;-webkit-transform: rotate(10deg); -moz-transform: rotate(10deg); -o-transform: rotate(10deg);}

 

 

JS代码


 

  

 



相关文章

精彩推荐