0

How do I get the currently active NON computed CSS property active on an element. For example;

$("#someElement").css("font-size");

Should return something like "15vh" not 55px or similar as that is the computed style.

If using Chrome Web Tool, this would be the top most CSS property under the Elements / Styles tab.

Using jQuery or not is fine.

Heretic Monkey
  • 11,687
  • 7
  • 53
  • 122
fatbatman
  • 73
  • 6
  • 2
    Check this answer to question [Get a CSS value from external style sheet with Javascript/jQuery](https://stackoverflow.com/a/16779702/387194) but it will only work in some cases, it's not ideal. – jcubic Feb 13 '19 at 21:02
  • 2
    The short answer is you shouldn't try to do it, even if you might be able to in some roundabout way. Can you share the reason why you're trying to do this? – Domino Feb 13 '19 at 21:31
  • I want to do this because I have a large number of pages that are sized by setting the font-size of a top level element in e.g. 10vh. This is fine on desktop devices but on Android the vh isn't always the full visible area if the address bar is present. So in that case I plan to add some javascript that will obtain actual visible height, then set the font-size of the top level element in px based on calculating a "real" vh. – fatbatman Feb 13 '19 at 22:21

0 Answers0