我試圖在懸停時逐漸改變元素的文字,但它不適用於我。純css逐漸改變懸停文字
我有這樣的CSS:
.author-details > div a {
display: inline-block;
width: 30%;
float: none !important;
background-color: #1ABC9C;
color: #fff;
padding: 2% 3% 2% 3%;
border-radius: 7%;
font-weight: normal;
font-size: 16px;
-webkit-transition: background 0.35s linear;
-moz-transition: background 0.35s linear;
-ms-transition: background 0.35s linear;
-o-transition: background 0.35s linear;
transition: background 0.35s linear;
-webkit-box-shadow: 0px 5px 13px -8px rgba(0,0,0,0.45);
-moz-box-shadow: 0px 5px 13px -8px rgba(0,0,0,0.45);
box-shadow: 0px 5px 13px -8px rgba(0,0,0,0.45);
}
.author-details > div a:after {
content: 'Others';
}
.author-details > div a:hover {
background-color: #5DADE2;
}
.author-details > div a:hover:after {
-webkit-animation:fade-in 0.35s ease-in;
}
@-webkit-keyframes fade-in{
0%{
opacity:1;
top:0px;
}
50%{
opacity:0;
top:-5px;
content: 'Me';
}
100%{
opacity:1;
top:-5px;
}
}
而這個HTML:
<div><label>View as: </label> <a href ="#" onClick="return false" onmousedown="javascript:swapContent('con1');"></a></div>
然而,當我徘徊在文本不會更改的元素。當我徘徊時,我想讓它變成「我」,當我不在時,我會回到「其他」。我怎樣才能做到這一點?
這裏有一個的jsfiddle:http://jsfiddle.net/2fgy912p/
http://jsfiddle.net/ysjoLz2u/1/ 支票本,供大家參考,我知道,不是固定您的問題,但它將作爲基本實施指南 –