CSS3折角效果程式碼

螞蟻小編發表於2018-07-02

本章節分享一段程式碼例項,它實現了折角效果。

程式碼例項如下:

[HTML] 純文字檢視 複製程式碼執行程式碼
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="author" content="http://www.softwhy.com/" />
<title>螞蟻部落</title>
<style>
.note {
  position: relative;
  display: inline-block;
  vertical-align: top;
  width: 15em;
  padding: 2em;
  margin: 0 1rem;
  color: white;
  font: 100%/1.6 Baskerville, Palatino, serif;
  border-radius: .5em;
  position: relative;
  background: #58a;
   
  background: linear-gradient(-155deg, rgba(0, 0, 0, 0) 1.5em, #5588aa 0%);
  border-radius: .5em;
}
.note::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  background: linear-gradient(to left bottom, rgba(0, 0, 0, 0) 50%, rgba(0, 0, 0, 0.2) 0%, rgba(0, 0, 0, 0.4)) 100% 0 no-repeat;
  width: 1.65507em;
  height: 3.5493em;
  transform: translateY(-1.89424em) rotate(-40deg);
  transform-origin: bottom right;
  border-bottom-left-radius: inherit;
  box-shadow: -0.2em 0.2em 0.3em -0.1em rgba(0, 0, 0, 0.15);
}
 
</style>
</head>
<body>
<div class="note"></div>
</body>
</html>

相關文章