I want a background image on my page (background.png), but some rogue CSS is thwarting me.
我想在我的页面上建立一个背景图片(background.png),但是一些流氓CSS正在挫败我。
I can see that my style.css from line 39 is being overwritten. I would think this is being done by something like style.css. I search and do not find anything but my original desired specification in that file. I can not find out what css is doing the overriding.
我可以看到第39行的style.css被覆盖了。我认为这是由style.css之类的东西完成的。我在该文件中搜索并找不到除原始所需规格之外的任何内容。我无法找出css正在做什么覆盖。
I have searched all the css files I can think of for the specified image (bg_p2_28.jpg). I have searched all the css files for background, nothing seems to come up. It is not being specified in the main HTML
我搜索了所有我能想到的指定图像的css文件(bg_p2_28.jpg)。我搜索了所有css文件的背景,似乎没有出现。它没有在主HTML中指定
I am barely struggling through as a reasonably competent programmer that has not used HTML since the mid 1990's. I am just trying to modify a template I bought.
作为一名自20世纪90年代中期以来一直没有使用HTML的合理的程序员,我几乎没有挣扎过。我只是想修改我买的模板。
What techniques can I use, or how do I interpret what I have here shown here to figure out what CSS override is ultimately being pushed into the page?
我可以使用哪些技术,或者如何解释我在此处显示的内容,以确定哪些CSS覆盖最终被推入页面?
EDIT:
编辑:
Adding the !important; works. It feels very dirty for some reason. I do not know why. I have tried following the javascript in, but the debugger is confusing to the uninitiated. Is the Important! a terrible thing to do, or reasonable? I think it would be useful to understand where these are being set in the java code, but when I search the code, I think the values are stored in variable, so can only be caught at run time.
添加!important;作品。由于某种原因感觉很脏。我不知道为什么。我已经尝试过跟随javascript,但是调试器对于不熟悉的人来说很困惑。重要的是!一件可怕的事情,还是合理的?我认为理解java代码中的设置位置会很有用,但是当我搜索代码时,我认为值存储在变量中,因此只能在运行时捕获。
3 个解决方案
#1
2
You could try background: url(src) !important;
, not the perfect solution, but i think it will work for you in this case.
你可以尝试背景:url(src)!important;,不是完美的解决方案,但我认为在这种情况下它会对你有用。
#2
7
That's coming from the inline style=""
attribute.
这来自内联样式=“”属性。
If you don't see it in the HTML source, it's probably being set by Javascript.
如果你没有在HTML源代码中看到它,它可能是由Javascript设置的。
You can right-click the element in the inspector and click Break on Attribute Modifications to find out where.
您可以右键单击检查器中的元素,然后单击“属性修改上的中断”以查找位置。
#3
2
The grey element.style
means that it's a style
attribute directly on the element itself. Any style on an element will override styles from style sheets unless the sytlesheet style is marked with !important
灰色元素.style意味着它直接在元素本身上是一个样式属性。元素上的任何样式都将覆盖样式表中的样式,除非sytlesheet样式标记为!important
#1
2
You could try background: url(src) !important;
, not the perfect solution, but i think it will work for you in this case.
你可以尝试背景:url(src)!important;,不是完美的解决方案,但我认为在这种情况下它会对你有用。
#2
7
That's coming from the inline style=""
attribute.
这来自内联样式=“”属性。
If you don't see it in the HTML source, it's probably being set by Javascript.
如果你没有在HTML源代码中看到它,它可能是由Javascript设置的。
You can right-click the element in the inspector and click Break on Attribute Modifications to find out where.
您可以右键单击检查器中的元素,然后单击“属性修改上的中断”以查找位置。
#3
2
The grey element.style
means that it's a style
attribute directly on the element itself. Any style on an element will override styles from style sheets unless the sytlesheet style is marked with !important
灰色元素.style意味着它直接在元素本身上是一个样式属性。元素上的任何样式都将覆盖样式表中的样式,除非sytlesheet样式标记为!important