简体   繁体   English

rem字体大小无法在css动画中正确呈现

[英]rem font-size not rendering properly in css animation

So I'm trying to have a sentence where certain words are animated (rotated through) - I thought it was working, but once I viewed the site on my mobile I found an issue. 所以我试着写一个句子,其中某些单词是动画的(旋转) - 我认为它有效,但是一旦我在手机上查看该网站,我发现了一个问题。 When viewed on a desktop (and even inside dev tools), the animated text is rendered in the correct size. 在桌面上(甚至在开发工具中)查看时,动画文本将以正确的大小呈现。 However, once I view it on a mobile device (iPhone), the text becomes super small 但是,一旦我在移动设备(iPhone)上查看它,文本就会变得非常小

I'm also using bootstrap on the page so I thought that maybe something was being overridden. 我也在页面上使用bootstrap,所以我想也许有些东西被覆盖了。 But as you can see I've basically removed all the bootstrap classes and it still isn't working. 但是你可以看到我基本上删除了所有的引导类,它仍然无法正常工作。

 .animated span { color: #007bff; font-size: 0; opacity: 0; -ms-animation: topToBottom 10s infinite; -webkit-animation: topToBottom 10s infinite; animation: topToBottom 10s infinite; } .animated span:nth-child(2) { -ms-animation-delay: 2s; -webkit-animation-delay: 2s; animation-delay: 2s; } .animated span:nth-child(3) { -ms-animation-delay: 4s; -webkit-animation-delay: 4s; animation-delay: 4s; } .animated span:nth-child(4) { -ms-animation-delay: 6s; -webkit-animation-delay: 6s; animation-delay: 6s; } .animated span:nth-child(5) { -ms-animation-delay: 8s; -webkit-animation-delay: 8s; animation-delay: 8s; } @-webkit-keyframes topToBottom { 0%, 20% { font-size: 2.5rem; opacity: 1; } /* visible for 1s */ 20.01%, 100% { opacity: 0; font-size: 0rem; } 
 <h1 class=" cover-heading animated">TribePulse replaces <br /> <span>status updates</span> <span>engagement surveys</span> <span>progress reports</span> <span>status meetings</span> <span>EoD emails</span> </h1> 

Demo on glitch: https://empty-cemetery.glitch.me/ When you view it on desktop, all the blue writing is the correct size. 关于故障的演示: https//empty-cemetery.glitch.me/当您在桌面上查看时,所有蓝色书写的大小都是正确的。 However, once you view it on mobile the animated text becomes tiny. 但是,一旦您在移动设备上查看它,动画文本就会变得很小。

Any help is greatly appreciated! 任何帮助是极大的赞赏! have been trying to fix this for hours now and just don't know what else I can try.. 一直试图解决这个问题几个小时,只是不知道我还能尝试什么..

you can check how your page looks and performs on a mobile device: 您可以查看您的网页在移动设备上的外观和效果:

https://developers.google.com/web/tools/chrome-devtools/device-mode/ https://developers.google.com/web/tools/chrome-devtools/device-mode/

you can also customize the contents using media queries.Media Queries for Standard Devices 您还可以使用媒体查询自定义内容。标准设备的媒体查询

If you want to know more info you can visit: https://css-tricks.com/snippets/css/media-queries-for-standard-devices/ 如果您想了解更多信息,请访问: https//css-tricks.com/snippets/css/media-queries-for-standard-devices/

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

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