Join us and the lead editor of IRL, Mozilla's multi-award-winning podcast, for a behind-the-scenes look at the pod and to contribute your ideas for the next season, themed: "AI and ME." Mark your calendar and join our Community Call on Wednesday, Aug 7, 17:00–17:45 UTC. See you there!

搜索 | 用户支持

防范以用户支持为名的诈骗。我们绝对不会要求您拨打电话或发送短信,及提供任何个人信息。请使用“举报滥用”选项报告涉及违规的行为。

详细了解

Delete an element on a webpage

more options

Okay so basically for example lets say i want to permanently just for my screen have this image deleted/or hidden whatever how can I do this without using an extension?

I believe someone brought up usercontent.css?

Okay so basically for example lets say i want to permanently just for my screen have this image deleted/or hidden whatever how can I do this without using an extension? I believe someone brought up usercontent.css?
已附加屏幕截图

所有回复 (1)

more options

In your other thread, you said you didn't want to use an add-on, you wanted to do it the hard way. ;-)

The userContent.css file holds style rules. For example:

selector { display: none !important; }

The trick is to figure out what CSS selector is associated with the element you want to hide, and it needs to be specific enough not to hide other things you don't want to hide. This is going to differ from one page to the next and typically takes some "hands on" work.

You already know how to use the Inspector, so you might find a unique selector based on an id, or one based on a class that you can make unique based on an ancestor element.

For a deeper dive: https://developer.mozilla.org/docs/Learn/CSS/Building_blocks/Selectors

To set up a userContent.css file, you use the same steps as a userChrome.css file but the file name is different. Also, you need to know about this feature if you want your rule only to apply to particular sites or pages:

https://developer.mozilla.org/docs/Web/CSS/@document

Note: Firefox requires it to be written with -moz- as @-moz-document.