【问题标题】:CSS Translate causes typo to breakCSS 翻译导致拼写错误
【发布时间】:2014-11-18 19:34:51
【问题描述】:

我正在尝试为我在网站上使用的菜单添加效果。 效果是添加了颜色变化的列表的第一个: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>

【问题讨论】:

标签: css fonts translate-animation


【解决方案1】:

这是改变不透明度的代码:

.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;
}

我将字体大小设置为 12 像素,不透明度设置为 1,请在此处查看:jsFiddle

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-02-05
    • 2015-12-21
    • 1970-01-01
    • 2018-11-25
    • 2016-09-10
    • 1970-01-01
    • 2011-07-21
    • 2018-06-15
    相关资源
    最近更新 更多