简体   繁体   English

CSS3转换不适用于Chrome和Firefox

[英]CSS3 Transform not working on Chrome and Firefox

I'm learning CSS3 Transform and Transition and I added translateY(-40px) on text of 'Velodyne vTrue Forged Aluminum Performance Studio Headphones w/ Leather (Refurb) $80 + Free Shipping' but this gonna move back to start point if I hover a mouse point on the box. 我正在学习CSS3转换和过渡,并且在“ Velodyne vTrue锻造铝制性能工作室耳机(配皮革)(Refurb)$ 80 +免运费”的文字上添加了translateY(-40px),但是如果我将鼠标悬停在鼠标指向框。 This problem on Chrome and Firefox. Chrome和Firefox上的此问题。 (style name '.area:hover desc') I uploaded sample code to http://jsfiddle.net/tza1515g (样式名称“ .area:hover desc”),我将示例代码上传到了http://jsfiddle.net/tza1515g

Please answer me what I wrong. 请回答我我错了。

<style>
.area {
    width: 200px;
    float: left;
    border: 1px solid #ddd;
    margin: 5px;
    padding: 20px;
    text-align: center;
    height: 230px;
    transition: background 0.3s;
    background: #333;
    color: #fff;
}
.area:hover {
    background: #0CF;
}
.icon {
    width: 50px;
    transition: transform 0.3s cubic-bezier(0, 0, 0, 2);
    transform: scale(1.5);
    -webkit-transition: transform 0.3s cubic-bezier(0, 0, 0, 2);
    -webkit-transform: scale(1.5);
    color: #fff;
}
.area:hover .icon {
    transform: scale(1);
}
.area h2 {
    font-weight: 700;
    text-transform: uppercase;
    transition: transform 0.3s cubic-bezier(0, 0, 0, 2);
    -webkit-transition: transform 0.3s cubic-bezier(0, 0, 0, 2);
}
.area:hover h2 {
    transform: scale(0.8) translateY(-25px);
    -webkit-transform: scale(0.8) translateY(-25px);
}
.desc {
    opacity: 0;
    color: #fff;
    transition: all 0.2s;
    -webkit-transition: all 0.2s;
}
.area:hover .desc {
    opacity: 1;
    transform: translateY(-40px);
    -webkit-transform: translateY(-40px);
}
</style>
<figure class="area">
    <img class="icon" src="data:image/png;base64,"/>
    <figcaption>
        <h2>Standard Management</h2>
        <span class="desc">
            Velodyne vTrue Forged Aluminum Performance Studio Headphones w/ Leather (Refurb) $80 + Free Shipping
        </span>
    </figcaption>
</figure>

When you are using the webkit version of the CSS rule, for example in line 26 , use -webkit-transition in the property to undergo transition instead of simply transform. 当您使用CSS规则的webkit版本时(例如,在第26行中) ,在属性中使用-webkit-transition进行转换,而不是简单地进行转换。

Also, you forgot the webkit version in line 31 (not an error just pointing it out). 另外,您在第31行中忘记了Webkit版本(并非仅指出该错误而已)。

Also, it is working here, but the transition is not very smooth, so is that what you are asking us to help you with? 此外,它在这里正常工作,但是过渡不是很顺利,所以您在要求我们提供帮助吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM