CSS3郵票鋸齒效果

antzone發表於2018-05-05

分享一段程式碼例項,它利用css3實現了郵票鋸齒效果。

程式碼例項如下:

[HTML] 純文字檢視 複製程式碼執行程式碼
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="author" content="http://www.softwhy.com/" />
<title>螞蟻部落</title>
<style>
.bg{
  width:300px;
  height:50px;
  background:#caca8c;
  background-image:-webkit-gradient(
    linear,50% 0,0 100%,
    from(transparent),
    color-stop(.5,transparent),
    color-stop(.5,#d86707),
    to(#d86707)    
  ),
  -webkit-gradient(
    linear,50% 0,100% 100%,
    from(transparent),
    color-stop(.5,transparent),
    color-stop(.5,#d86707),
    to(#d86707)                                            
  );                                
  background-size:20px 10px;
  background-repeat:repeat-x;
  background-position:0 100%;                   
}
</style>
</head>
<body>
<div class="bg"></div>
</body>
</html>

相關文章