欢迎来到DIVCSS5查找CSS资料与学习DIV CSS布局技术!
  CSS3perspective属性
 
  作用:perspective属性定义3D元素距视图的距离,以像素计。该属性允许您改变3D元素查看3D元素的视图。当为元素定义perspective属性时,其子元素会获得透视效果,而不是元素本身。
 
  注:perspective属性只影响3D转换元素。
 
  语法:
 
  perspective:number|none;
 
  number:元素距离视图的距离,以像素计。
 
  none:默认值。与0相同。不设置透视。
 
  说明:该属性要与perspective-origin属性一同使用,这样就能够改变3D元素的底部位置。
 
  CSS3perspective属性的使用示例
 
  
 
  
 
  <!DOCTYPEhtml>
 
  <html>
 
  <head>
 
  <style>
 
  #div1
 
  {
 
  position:relative;
 
  height:150px;
 
  width:150px;
 
  margin:50px;
 
  padding:10px;
 
  border:1pxsolidblack;
 
  perspective:150;
 
  -webkit-perspective:150;/*SafariandChrome*/
 
  }
 
  #div2
 
  {
 
  padding:50px;
 
  position:absolute;
 
  border:1pxsolidblack;
 
  background-color:yellow;
 
  transform:rotateX(45deg);
 
  -webkit-transform:rotateX(45deg);/*SafariandChrome*/
 
  }
 
  </style>
 
  </head>
 
  <body>
 
  <divid="div1">
 
  <divid="div2">HELLO</div>
 
  </div>
 
  </body>
 
  </html>






本文转载自中文网

 

如需转载,请注明文章出处和来源网址:http://www.divcss5.com/css3-style/c56256.shtml