CSS Translate导致打字错误

时间:2014-09-24 10:32:37

标签: css fonts translate-animation

我试图将效果添加到我在网站上使用的菜单中。 效果是添加了颜色更改的列表中的第一个:http://tympanus.net/Development/CreativeLinkEffects/

但是当我尝试将它应用到我的情况时,我有一个奇怪的问题发生在没有悬停的元素上。您可以看到未悬停的元素在悬停在元素上时会改变不透明度和字体大小。

我在这里添加了演示:



a{
    text-decoration:none;
}

/* Effect 15: scale down, reveal */
 .cl-effect-15 a {
    color: #FFF;
    text-shadow: none;
}
.cl-effect-15 a::before {
    margin-right: 10px;
    content:'[';
    -webkit-transform: translateX(20px);
    -moz-transform: translateX(20px);
    transform: translateX(20px);
}
.cl-effect-15 a::after, .cl-effect-15 a::before {
    display: inline-block;
    opacity: 0;
    -webkit-transition: -webkit-transform 0.3s, opacity 0.2s;
    -moz-transition: -moz-transform 0.3s, opacity 0.2s;
    transition: transform 0.3s, opacity 0.2s;
    font-size: 12px;
}
.cl-effect-15 a::after {
    margin-left: 10px;
    content:']';
    -webkit-transform: translateX(-20px);
    -moz-transform: translateX(-20px);
    transform: translateX(-20px);
}
.cl-effect-15 a:hover::before, .cl-effect-15 a:hover::after, .cl-effect-15 a:focus::before, .cl-effect-15 a:focus::after {
    opacity: 1;
    -webkit-transform: translateX(1px);
    -moz-transform: translateX(0px);
    transform: translateX(1px);
    font-size: 14px;
}
.totblockhtml.html_2 {
    padding-bottom:10px;
    margin-bottom:0px;
}
.totblockhtml.html_2 {
    margin-bottom: 0px;
    padding-bottom: 9px;
    padding-top: 4px;
    width: 100%;
    float: left;
    background: none repeat scroll 0 0 #282F47;
    margin-top: -20px;
    background-image: url(../img/BlueJean.svg);
}
.totblockhtml.html_2 .block_content {
    text-align:center;
    color:#ababab;
    padding-top: 5px;
}
.totblockhtml.html_2 ul li {
    display: inline-block;
    margin-left: 70px;
    font-size: 14px;
    font-family:"trajanpro_regular";
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
}
.totblockhtml.html_2 ul li:first-child {
    margin-left:0px;
}
.totblockhtml.html_2 ul li a {
    color: #9099AF;
    font-size: 11px;
    font-family:"Cinzel";
    text-transform: uppercase;
    letter-spacing: 2px;
    -webkit-transition: color 0.5s ease;
    -moz-transition: color 0.5s ease;
    -ms-transition: color 0.5s ease;
    -o-transition: color 0.5s ease;
    transition: color 0.5s ease;
}
.totblockhtml.html_2 ul li a:hover {
    text-decoration:none;
    color: #fff;
}

<div class="block totblockhtml html_2">
    <div class="block_content">
        <ul class="top_menu ">
            <li class="top_menu_search cl-effect-15"><a href="#">Rechercher</a>

            </li>
            <li class="top_menu_sell cl-effect-15"><a href="#">Vendre</a>

            </li>
            <li class="top_menu_advice  cl-effect-15"><a href="#">Conseils </a>

            </li>
        </ul>
    </div>
</div>
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:0)

以下是更改不透明度的代码:

.cl-effect-15 a::after, .cl-effect-15 a::before {
    -webkit-transition: -webkit-transform 0.3s, opacity 0.2s;
    -moz-transition: -moz-transform 0.3s, opacity 0.2s;
    transition: transform 0.3s, opacity 0.2s;
}

这是改变字体大小的那个:

.cl-effect-15 a:hover::before, .cl-effect-15 a:hover::after, .cl-effect-15 a:focus::before, .cl-effect-15 a:focus::after {
    font-size: 14px;
}

我将font-size设置为12px,将opacity设置为1,请在此处查看:jsFiddle