我在使用 CSS 时遇到了一些问题,当我在移动设备上尝试该网站时,行高保持在 65px,这可以通过在前面放置一个 !important 来解决,但这不是我想要的解决方法,应该我在上课还是什么?
非常感谢
/*Change the glyph size when necessary*/
@media only screen and (max-width:990px)
{
#IEGlyphPlacement
{
line-height: 80px;
}
}
#Glyph
{
line-height: 65px;
}
最佳答案
您正在针对媒体查询中的不同元素。媒体查询以 ID 为 IEGlyphPlacement
的元素为目标,而不是 Glyph
(您在非媒体查询代码中定义)。
更新如下:
/*Change the glyph size when necessary*/
@media only screen and (max-width:990px)
{
#Glyph
{
line-height: 80px;
}
}
#Glyph
{
line-height: 65px;
}
关于html - ID 和媒体查询的特异性问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31809222/