I want to apply styles (edit:in my browser's user-defined stylesheet, a local file on my machine that let's me customize how other people's websites render for me) to a specific site, but the selectors on many web pages are often generic (and obviously out of my control, since they're not my websites.)
If I have to use very general selectors (eg. #box) to customize a given website, that style might unintentionally affect other websites that have that same generic selector. Is there a way to specify a domain with a selector so I can my custom styles for each website separate?
I also found @-moz-document which looks good, but is Mozilla-specific and I use a WebKit browser. Is there an equivalent?
@-moz-document url(https://www.example.com/decrypt.php) {
The CSS id Selector To select an element with a specific id, write a hash (#) character, followed by the id of the element.
The :host-context() CSS pseudo-class function selects the shadow host of the shadow DOM containing the CSS it is used inside (so you can select a custom element from inside its shadow DOM) — but only if the selector given as the function's parameter matches the shadow host's ancestor(s) in the place it sits inside the ...
Any Selector Can Be Grouped You can place any valid selector in a group, and all elements in the document that match all the grouped elements will have the same style based on that style property.
selector descendant-selector, e.g. nav a . This applies to all descendants of the selected kind that have the selected ancestor. a:link, a:visited, a:hover and a:active. These pseudo-selectors allow you to style hyperlinks based on their state.
Is the CSS hosted on a server that also allows you to script? Have you tried writing a server-side script to generate the correct CSS rules depending on the host that's serving the page?
Edit added March 30 2010:
You might be better off using the Greasemonkey extension to do this. It's far more powerful than user-defined stylesheets since you can use JavaScript, and adding domain or page-specific rules is as easy as adding special tags to the comments in the header. Greasemonkey was made specifically for handling your type of problem, and while you need a plugin to run Greasemonkey scripts in Firefox, Chrome ships with Greasemonkey support built-in.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With