我用你提到的創造這個給你的鏈接鉻督察。請提出問題,其答案也可以幫助其他人。
通知,旁邊的CSS3變換特技是
.roll跨度:後
,所述懸停的元件的數據標題屬性的內容將被獲取並施加到內容屬性:
.roll span:after {
content: attr(data-title);
}
<span data-title="Home">Home</span>
body{
background-color:grey;
}
.navbar .navbar-inner {
\t margin-top: 80px;
}
.navbar .nav {
\t float: right;
\t margin-right: 0;
}
.navbar .nav li {
\t display: inline-block;
\t float: none;
\t overflow: hidden;
\t transform: translate3d(0,0,0);
}
.navbar-nav>li>a {
\t padding-top: 13px;
\t padding-bottom: 7px;
}
.navbar .nav li:last-child a {
\t padding-right: 0;
}
.lt-ie8 .navbar .nav li {
\t display: block;
\t float: left;
}
.roll {
\t display: inline-block;
\t overflow: hidden;
\t z-index: 200;
\t position: relative;
\t vertical-align: top;
\t -webkit-transform-style: preserve-3d;
\t -moz-transform-style: preserve-3d;
\t -webkit-perspective: 400px;
\t -moz-perspective: 400px;
\t -webkit-perspective-origin: 50% 50%;
\t -moz-perspective-origin: 50% 50%;
}
.roll span {
\t display: block;
\t position: relative;
\t padding: 0 2px;
\t -webkit-transition: all 400ms ease;
\t -moz-transition: all 400ms ease;
\t pointer-events: none;
\t -webkit-pointer-events: none;
\t -webkit-transform-origin: 50% 0%;
\t -moz-transform-origin: 50% 0%;
\t -webkit-transform-style: preserve-3d;
\t -moz-transform-style: preserve-3d;
\t overflow: hidden;
\t height: 18px;
}
a.roll:hover span {
\t overflow: visible;
\t -webkit-transform: translate3d(0px, 0px, -30px) rotateX(90deg);
\t -moz-transform: translate3d(0px, 0px, -30px) rotateX(90deg);
}
.roll span:after {
\t content: attr(data-title);
\t display: block;
\t position: absolute;
\t left: 0;
\t top: 1px;
\t padding: 0 2px;
\t color: #323C46;
\t background: #fff;
\t -webkit-transform-origin: 50% 0%;
\t -moz-transform-origin: 50% 0%;
\t -webkit-transform: translate3d(0px, 105%, 0px) rotateX(-90deg);
\t -moz-transform: translate3d(0px, 105%, 0px) rotateX(-90deg);
}
<body>
<div class="navbar">
<ul id="menu-primary-navigation-en" class="nav navbar-nav">
<li class="active menu-home">
<a href="https://riot.design/en/" class=" roll"><span data-title="Home">Home</span></a>
</li>
<li class="menu-about">
<a href="https://riot.design/en/about/" class=" roll"><span data-title="About">About</span></a>
</li>
<li class="menu-portfolio">
<a href="/en/portfolio/" class=" roll"><span data-title="Portfolio">Portfolio</span></a>
</li>
<li class="menu-contacts">
<a href="https://riot.design/en/contacts/" class=" roll"><span data-title="Contacts">Contacts</span></a>
</li>
</ul>
</div>
</body>
請[開始瀏覽](http://stackoverflow.com/tour)然後讀[我可以問什麼議題有關(http://stackoverflow.com/幫助/切合主題) 和[如何問一個很好的問題(http://stackoverflow.com/help/how-to-ask) 和[完美的問題(http://codeblog.jonskeet.uk/2010/08/29/writing-the-perfect-question /) 以及如何創建[Minimal,Complete and Verifiable Example](http://stackoverflow.com/help/mcve) – RiggsFolly