Google Chrome - CSS 文本转换不起作用
所以我有这段代码可以在 Firefox 中运行,但不能在 Chrome 中运行。我所做的只是设计一些文本样式。我不明白为什么它在 chrome 中不起作用。
#hidden {
color: #999;
text-decoration: none;
text-transform: uppercase;
}
html
<p id="hidden">**hidden**</p>
Chrome 正在返回未更改的版本 (黑色,非大写 **hidden**)
而 firefox 则返回灰色 **HIDDEN**
那么有什么解决办法吗为了这?我有点震惊 chrome 不支持这么简单的东西。
So I have this code that works in firefox but not chrome. All I am doing is just styling some text. I don't understand why it doesn't work in chrome.
#hidden {
color: #999;
text-decoration: none;
text-transform: uppercase;
}
And html
<p id="hidden">**hidden**</p>
Chrome is returning the unaltered version (a black, not uppercased **hidden**)
While firefox kindly returns a gray **HIDDEN**
So is there any fix for this? I am kind of shocked chrome doesn't support something so simple.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我对此进行了猜测,但这可能只是 Chrome 处理标记错误的方式。根据我的经验,Chrome 倾向于忽略无效 CSS 以下的任何 CSS,这使我相信最可能的原因是 CSS 或 HTML 中有错误。
对此的一个非常快速、良好的检查是将您关心的未更新元素设置为
display: none;
并查看它是否消失。如果它仍然可见,则问题出在不同的元素上。您还可以使用 W3C HTML 验证器 和 CSS Validator 如果您正在寻找一些不错的自动化工具来检查您的标记。I'm taking a guess at this, but it could just be the way that Chrome deals with errors in your markup. In my experience, Chrome tends to ignore any CSS that is below invalid CSS, which leads me to believe that the most likely cause for this is that you have an error in your CSS or HTML.
A really quick, nice check for this is to set the element you are concerned isn't updating to
display: none;
and see if it disappears. If it is still visible, the problem is on a different element. You can also use the W3C HTML Validator and CSS Validator if you are looking for some nice, automated tools for checking your markup.