搜尋 Mozilla 技術支援網站

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Use Inspect Element to locate file with styles

  • 5 回覆
  • 8 有這個問題
  • 8027 次檢視
  • 最近回覆由 cor-el

more options

Running FF 17.0.1 and the Inspect Element feature seems very powerful, but I can't figure out something that used to be easy: When I'm viewing a particular element, how do I see the name of the filepath where that element is stored? I'm working on a site I didn't create, and can't find where a particular style tag is located.

Thanks!

所有回覆 (5)

more options
more options

Thank you for your response. Those links explain the basic functions of the tool pretty well, but unfortunately don't answer my question. Either I've misunderstood something I read, or maybe what I want isn't actually possible.

Let me be more specific: I have an entire website on my local machine that I did DLed but did not create. Looking at style elements on the live site, I'd like to know the exact filepath to a given style.

Thank you

more options

If you have opened the inspector and have selected an element then the Rules tab shows all rules that are found and in which file and line. A click on that link opens the style editor window that allows live editing of CSS rules and save the changes.

You can also look at the DOM Inspector.

more options

cor-el, I really appreciate you taking the time to help, and I realize I may seem slow, but when I highlight an element whose filepath I want, I'm getting this:

element { inline

   font-size: 88%;
   z-index: 0;
   position: static;
   display: block;
   background-color: rgb(153, 204, 255);

}

...which is great, but where is this block located? I can click on "inline", which opens up a page of html code, but the above is not present on the opened page.

I know I'm missing something here. So close...

more options

If the CSS code is inline then it should be in the main HTML file, but it is possible that the position (line number) is not known, so you may need to do a search via Ctrl+F.

Styles that are otherwise added via an extension like stylish or userContent.css will probably also show as inline CSS code.

I would have to look at such a page to see what is happening in your case.

Did you try the DOM Inspector?