javascript – 字体家族CSS过渡
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了javascript – 字体家族CSS过渡,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1355字,纯文字阅读大概需要2分钟。
内容图文
![javascript – 字体家族CSS过渡](/upload/InfoBanner/zyjiaocheng/727/78e1dbb20cee441f9667531ec618796d.jpg)
我想得到一个悬停动画,同时改变font-size和font-family.在字体大小转换完成后,我无法准确地更改字体系列.这甚至可能吗?
是)我有的:
a{
-webkit-transition: font-size .2s ease;
-moz-transition: font-size .2s ease;
-o-transition: font-size .2s ease;
-ms-transition:font-size .2s ease;
transition: font-size .2s ease;
}
a:hover{
font-family: "MyHoverFont";
font-size: 3em;
}
我尝试了什么:
a{
...
-webkit-transition: font-family.2s ease;
-moz-transition: font-family .2s ease;
-o-transition: font-family .2s ease;
-ms-transition: font-family .2s ease;
transition: font-family .2s ease;
}
a:hover{
...
font-family: "MyHoverFont"
}
解决方法:
您不能使用font-family的动画或过渡.这意味着,你实际上可以做到这一点,但它会立即改变font-family而不是从一个font-family变形到另一个.
但我找到了一个很好的解决方法(here):
You could do the following: have two divs, each with the same text but
different font. The second div is absolute positioned below the first
div and hidden by default. When the times comes to “morph” the font,
animate the first visible div opacity to 0, and the second div to 1.
It should look like it’s morphing at the expense of a little more
convoluted mark up.
暗示
您似乎执行以下操作:
a {
...
transition: font-size .2s ease;
...
transition: font-family .2s ease;
}
但在这种情况下,第二条规则会覆盖第一条规则,因此以下是您通常所做的事情:
transition: font-size .2s ease, font-family .2s ease;
内容总结
以上是互联网集市为您收集整理的javascript – 字体家族CSS过渡全部内容,希望文章能够帮你解决javascript – 字体家族CSS过渡所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。