有没有办法找出CSS规则的来源? [英] Is there a way to find out where a css rule is coming from?

查看:99
本文介绍了有没有办法找出CSS规则的来源?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我继承了.asp网站,并且不得不更新页面以将表格中的表格重新定位到侧边栏.

I've inherited an .asp website and had to update the pages to relocate forms in tables to the sidebar.

除了一页纸之外,它在所有页面上都正常工作,该页面顽固地拒绝接受我的CSS,并从知道谁的地方获取价值.

It's worked fine on all but one page which stubbornly refuses to accept my css and is taking values from who knows where.

我曾尝试在Firefox/Chrome中进行调试,甚至在页面顶部编写了规则,但均无济于事.是否有用于识别这种事情的工具?我对CSS并不陌生,但这让我感到困惑.我不希望使用javascript来解决此问题,因为我将其视为一个基本问题.

I've tried debugging in Firefox/Chrome and even written rules in the head of the page but to no avail. Is there a tool for identifying this kind of thing? I'm no slouch with css but this is baffling me. I don't want to resort to javascript to fix this as I see it as a fundamental issue.

有没有办法找出css规则的来源?

Is there a way to find out where a css rule is coming from?

推荐答案

您可以在Chrome中使用网络检查器.

You may use web inspector in Chrome.

右键单击失败的元素,然后选择检查元素.

Right click on failing element and select inspect element.

您应该最终得到带有两个部分的Web检查器窗口:左边是html节点树,右边是所选节点的样式和属性.失败元素应该已经选择.

You should end up with web inspector window with two sections: left is html nodes tree and right is styles and properties of selected node. Failing element should be selected already.

接下来,您需要展开计算样式"标签,然后查找令人反感的样式.

Next you need to expand "Computed Style" tab and look for offending style.

找到后,您会在样式定义的左侧看到一个小三角形-它是可单击的.单击时,它应该展开影响该元素此样式的选择器列表.您将看到每个URL的css.宾果游戏.

When found, you'll see small triangle to the left of style definition - it is clickable. On click it should expand list of selectors that affects this style for this element. You'll see url to css for each of this. Bingo.

这篇关于有没有办法找出CSS规则的来源?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆