1
这是我在css中的代码。它覆盖了用HTML文件编写的样式。我无权更改HTML。CSS样式覆盖在移动浏览器上不起作用
body[style] {
background-color: yellow !important ;
background: solid;
}
在桌面版Chrome上,背景更改为黄色就好了。无法在iphone上使用移动版Chrome for Safari。
<body bgcolor="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" style="margin-left: auto; margin-right: auto; width: 900px;">
我无权访问html。这是一个网站,可以选择参考您在本地存储的自己的样式表。虽然谢谢! – Daniel 2013-02-13 06:43:53
由于背景是在HTML元素中分配的,所以您无法覆盖它,因为浏览器将直接元素的样式计为优先级。 – shnisaka 2013-02-13 17:40:26
这很有道理,但为什么我的代码可以在某些浏览器(特别是桌面)上使用而不是其他(移动)? – Daniel 2013-02-13 19:57:17