CSS3梯形效果代码实例

快乐打工仔 分类:实例代码

CSS3梯形效果代码实例属于前端实例代码,有关更多实例代码大家可以查看

分享一段代码实例,它实现了梯形效果。

代码实例如下:

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="author" content="http://www.pipipi.net/" />
<title>前端教程网</title>
<style type="text/css">
.trapezoid{
  position: absolute;
  top:50%;
  left: 50%;
  transform:translate(-50%,-50%);
  width: 160px;
  padding: 60px;
  text-align: center;
  color: white;
  font-size: 200%;
}
.trapezoid:before{
  content:"";
  position: absolute;
  top: 0; 
  right: 0; 
  bottom: 0; 
  left: 0;
  transform:perspective(40px) scaleY(1.3) rotateX(5deg);
  transform-origin: bottom;
  background:deeppink;
  z-index:-1;
}        
</style>
</head>
<body>
<div class="trapezoid"></div>
</body>
</html>

CSS3梯形效果代码实例,这样的场景在实际项目中还是用的比较多的,关于CSS3梯形效果代码实例就介绍到这了。

回复

我来回复
  • 暂无回复内容