让我们看看其中一个效果,“Kukuri”:
这种效应只是给A标签加一个data的属性:
<a class="link link--kukuri" href="#" data-letters="Kukuri">Kukuri</a>
所有连接的基本样式如下:
.link { outline: none; text - decoration: none; position: relative; font - size: 8em; line - height: 1; color: #9e9ba4; display: inline - bloc; }
下面是动画效果的CSS:
.link--kukuri { text-transform:uppercase; font-weight:900; overflow:hidden; line-height:0.75; color:#b2b0a9; } .link--kukuri:hover { color:#b2b0a9; } .link--kukuri::after { content:''; position:absolute; gi height:16px; width:100%; top:50%; margin-top:-8px; right:0; background:#F9F9F9; transform:translate3d(-100%,0,0); transition:transform 0.4s; transition-timing-function:cubic-bezier(0.7,0,0.3,1); } .link--kukuri:hover::after { transform:translate3d(100%,0,0); } .link--kukuri::before { content:attr(data-letters); position:absolute; z-index:2; overflow:hidden; color:#424242; white-space:nowrap; width:0%; transition:width 0.4s 0.3s; } .link--kukuri:hover::before { width:100%; }
That`s all!