I think this is what you're asking...
Yes, all CSS properties use camel-case in JavaScript in place of dashes, so just like background-color
becomes backgroundColor
, box-sizing
becomes boxSizing
, and you could call:
document.body.style.boxSizing = 'inherit';
It seems like you may be asking about the best way to handle CSS with React, also, so you might want to check this out: https://github.com/css-modules/css-modules
EDIT: Really, I'd recommend against using the * in any context, but if instead of intending to apply this in the scope of a component, you're looking to apply it to the whole page, it's probably easier not to add it through JS. If you really had to and you didn't want to use CSSModules, I'm sure you could do something like:
var allElements = [].slice.call(document.querySelectorAll('*'));
allElements.map(function(element) {
element.style.boxSizing = 'inherit';
});
That said, this won't apply to pseudo-elements like :before
and :after
, because they're not actually part of the DOM: https://stackoverflow.com/a/5041526/1667063