0

I have noticed that Chrome browser's dialogs (e.g. Settings page, Print Dialog, etc) are written in HTML, CSS. I'd like to override the CSS for those dialogs.

I am creating a Chrome extension that exposes a custom Printer using Chrome's PrinterProvider API and configured using Google's Cloud Device Description format.

My printer now appears in the Print Dialog and is working fine. My issue is that some HTML elements in Chrome's Print dialog can be displayed better. For example, I'd like to increase the <input> and <select> elements' widths to better display the print options I am exposing.

Right-clicking > Inspect Element, on Chrome's print dialog, I see that the print dialog is just the HTML page chrome://print with some CSS defined inline, and some in CSS files found in chrome://resources/css/*.css

Is there a way to override these styles?

Obay
  • 3,135
  • 15
  • 55
  • 78
  • It's called [CSS reset](https://www.google.ie/search?q=css+reset). As for your question *"Is there a way to override these styles?"* - I'm assuming you're not completely oblivious to how CSS specificity works, so I guess you're asking if there's a way to tell Chrome not to apply those styles in the first place? **Nope.** Can one load custom ones instead of default? **Nope.** Was removed [~3 years ago](https://codereview.chromium.org/66383005/). – tao Nov 28 '17 at 04:16
  • 4
    Possible duplicate of [Can you access chrome:// pages from an extension?](https://stackoverflow.com/questions/19042857/can-you-access-chrome-pages-from-an-extension) – Daniel Herr Nov 28 '17 at 04:56
  • @DanielHerr Not a duplicate. In the linked question, the asker wants to run his extension on a `chrome://` page, probably execute some JavaScript. What I'm trying to do is change the appearance of a `chrome://` page with CSS only when condition is met (i.e. apply a CSS to the Chrome Print Dialog when my Printer is selected by the user). The suggested answer is also not an option in my case. – Obay Nov 28 '17 at 07:34
  • @AndreiGheorghiu The question is not regarding default user stylesheets applied to web pages. I'm trying to override styles on Chrome browser's dialogs themselves. – Obay Nov 28 '17 at 07:36
  • 1
    Injecting CSS uses the same mechanism as running a content script so the question is a duplicate of the linked one and the answer is the same. – wOxxOm Nov 28 '17 at 20:26

0 Answers0