CSS3折角效果代码实例

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

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

分享一段代码,它实现矩形折角效果,代码实例如下:

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="author" content="http://www.pipipi.net/" />
<title>前端教程网</title>
<style type="text/css">
.corner{
  position: absolute;
  top:50%;left: 50%;
  transform:translate(-50%,-50%);
  width: 120px;line-height:120px;
  padding:40px;
  text-align: center;
  color: white;
  font-size: 200%;
  background:linear-gradient(-150deg,transparent 1.5em, yellowgreen  0);
  border-radius:.5em;
}
.corner:before{
  content: '';
  position: absolute;
  top: 0; 
  right: 0;
  background:
    linear-gradient(to left bottom,transparent 50%, 
    rgba(0,0,0,.2) 0, 
    rgba(0,0,0,.4)) 100% 0 no-repeat;
  width: 1.73em; 
  height: 3em;
  transform: translateY(-1.3em) rotate(-30deg);
  transform-origin: bottom right;
  border-bottom-left-radius: inherit;
  box-shadow: -.2em .2em .3em -.1em rgba(0,0,0,.15);
}
</style>
</head>
<body>
<div class="corner"></div>
</body>
</html>

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

一线大厂高级前端编写,前端初中阶面试题,帮助初学者应聘,需要联系微信:javadudu

回复

我来回复
  • 暂无回复内容