Αναζήτηση υποστήριξης

Αποφύγετε τις απάτες υποστήριξης. Δεν θα σας ζητήσουμε ποτέ να καλέσετε ή να στείλετε μήνυμα σε κάποιον αριθμό τηλεφώνου, ή να μοιραστείτε προσωπικές πληροφορίες. Παρακαλούμε αναφέρετε τυχόν ύποπτη δραστηριότητα μέσω της επιλογής “Αναφορά κατάχρησης”.

Learn More

Custom css

  • 18 απαντήσεις
  • 1 έχει αυτό το πρόβλημα
  • 281 προβολές
  • Τελευταία απάντηση από cor-el

more options

Hello! I have problems creating my own CSS style. Most of the changes were applied by the browser through userChrome.css and userContent.css, but those elements that use common.css ignore it. What to do in my case?

Συνημμένα στιγμιότυπα

Επιλεγμένη λύση

Okay, found the other page by pasting

about:preferences#containers

to the address bar and pressing Enter to load it. Similar idea, except this time it's a <window> instead of a <dialog>:

window#ContainersDialog input, 
window#ContainersDialog textarea {
  color: white !important;
  background-color: red !important;
}
Ανάγνωση απάντησης σε πλαίσιο 👍 0

Όλες οι απαντήσεις (18)

more options

You can see in the Rules panel view that this is about an element in the html namespace, so you will have to use a selector that includes a namespace (*|xxx) to override an existing rule.

The code needs to be in userChrome.css, and probably above the default @namespace line or in a file without a namespace line imported via an @import url(); rule in userChrome.css.

*|input {...}
more options

cor-el , сan you show what the rule will look like for the above example?

more options

What element do you want to change (i.e. override what rule)?

A see this selector active (bold): xul|textbox[focused] I'm not sure if you will be able to override such an element select.

Did you check this common.css file to see what namespace lines are at the top of the file?

more options

For the “Settings” item, I imported a separate file to which I added: @namespace html "http://www.w3.org/1999/xhtml"; @namespace xul "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";

html|input[type="email"]:focus, html|input[type="tel"]:focus, html|input[type="text"]:focus, html|input[type="number"]:focus, html|textarea:focus, xul|textbox[focused] {

 border-color: red !important;
 box-shadow: 0 0 0 1px #5294e2,
   0 0 0 4px #5294e2 !important;

}

html|input[type="email"], html|input[type="tel"], html|input[type="text"], html|input[type="number"], html|textarea, xul|textbox {

   background-color: red !important;

}

This rule also applies to sites. If add "@-moz-document url(about:preferences)" the rule stops working altogether.

more options

Code with @-moz-document for about:preferences would normally go in userContent.css and not in userChrome.css

more options

It does not work. Of course, there are special cases where the code works if added to userContent.css, but this is not it.

more options

As a proof of concept in a userContent.css file, this works for me. There is a green input on about:config, and a red search box on about:preferences. The reason for using url-prefix is the hashes that are added to the URL when you go to different parts of the page.

input, textarea {
  color: white !important;
  background-color: green !important;
}
@-moz-document url-prefix("about:preferences") {
  input, textarea {
    background-color: red !important;
  }
}

Note: I don't specify any namespace at the top of the file.

more options

jscher2000, I need to change only on the settings page, without touching the sites. This will affect the sites: input, textarea {

 color: white !important;
 background-color: green !important;

} The second part does not work for me without the first, but it affects sites.

more options

Just to be sure: This code is for userContent.css

@-moz-document url-prefix("about:preferences") {
  input, textarea {
    background-color: #ffa !important;
  }
}
more options

Apparently, to explain that you draw other elements that can be drawn without problems, and those that should be painted, colors are ignored or affect the sites, I can not. In any case, thank you for your attention...

more options

What are the complete contents of your userContent.css file so I can test them? To prevent this site from mangling your style rules, please put <pre> before and </pre> after them in your reply. Or you can use a site like Pastebin to share them.

more options

I created an empty userContent.css. There is nothing besides your code.

more options

Hmm, should work. I added color:white to the section specific to the Options/Preferences page. Attached screenshot shows the results.

more options

I am interested in other elements. This code does not color the necessary ones. Go to the container menu or network settings. See how much white? THESE ELEMENTS NEED ME! THESE! The last picture was taken with a dark theme to show how many there are.

more options

I don't know what that first screenshot is. Is it a drop-down panel or popup window generated by an extension??

In the third screenshot, that connection settings dialog is loaded in a <browser> element, which seems to be like an iframe. So our rule doesn't style that.

When I use Firefox's Page Inspector, I see the top level element in the frame is a <dialog> with id="ConnectionsDialog" so with that in mind, try this:

dialog#ConnectionsDialog input,
dialog#ConnectionsDialog textarea {
  color: white !important;
  background-color: red !important;
}
more options

Επιλεγμένη λύση

Okay, found the other page by pasting

about:preferences#containers

to the address bar and pressing Enter to load it. Similar idea, except this time it's a <window> instead of a <dialog>:

window#ContainersDialog input, 
window#ContainersDialog textarea {
  color: white !important;
  background-color: red !important;
}

Τροποποιήθηκε στις από το χρήστη jscher2000

more options

It looks like this code really works. Thank you for help!

more options

Or with the @-moz-document selector:

@-moz-document 
 url-prefix("about:preferences"),
 url("chrome://browser/content/preferences/containers.xul"){
  input,textarea {
    color: white !important;
    background-color: red !important;
 }
}

Τροποποιήθηκε στις από το χρήστη cor-el