I was able to get user stylesheets using document.styleSheets
but I can't find the "user agent" stylesheets.
Is there a way to get default user agent styles?
Asked
Active
Viewed 833 times
8

bobharley
- 662
- 3
- 17
-
Do you want an element's style in the state where no style is applied or do you explicitly want the user agent stylesheet? You could probably use [`getComputedStyle`](https://developer.mozilla.org/en-US/docs/Web/API/Window/getComputedStyle). What do you intend to do with this? – zero298 Jul 06 '18 at 00:20
-
I need the user agent stylesheet – bobharley Jul 06 '18 at 00:33
-
2None of the duplicates describe a way to retrieve style property values from the user agent stylesheet. Voting to reopen this. – AndrewL64 Dec 30 '18 at 19:05
-
1@zero298 It is possible to use `getComputedStyle` but it wouldn't return where the style came from, or whether the style is a browser default or a style from a css file. – bobharley Jan 02 '19 at 07:41
-
1https://developer.mozilla.org/en-US/docs/Web/API/window/getDefaultComputedStyle Too bad almost no browser implements it. – Marc M. Sep 25 '22 at 18:18