clip-path path()实现图标变化效果实例页面
展示
点击下面的图标
代码
-
HTML:
<button class="icon-arrow"></button>
-
CSS:
.icon-arrow { width: 32px; height: 32px; background: linear-gradient(45deg, deepskyblue, deeppink); clip-path: path("M16.016 1.157l-15.015 15.015h9.009v16.016h12.012v-16.016h9.009z"); transition: .2s; } .icon-arrow:active { clip-path: path("M16.016 31.187l15.015-15.015h-9.009v-16.016h-12.012v16.016h-9.009z"); }