Re:ReactCSS – Bringing Classes to Inline Styles
by snookca on Friday July 03, 2015 @07:43PM
(#9828498)
While you can't modify pseudo elements or pseudo classes, you can replicate them using actual elements and conditional logic. I've seen React examples that do just that.
Re:ReactCSS – Bringing Classes to Inline Styles
by danr4 on Friday July 03, 2015 @03:44PM
(#9827577)
Good point.
This is why I think there is a place for a hybrid of javascript styles which are processed by build tools to generate style sheets.
https://github.com/teal-lang is an interesting approach
Inline styles can't modify psuedo-elements or psuedo-styles. You'll need to define styles for :before, :focus, :active, etc. in a stylesheet. These selectors are really important if you want to make appealing forms, e.g. http://blog.circleci.com/adaptive-placeholders/
Vendor prefixes are difficult to do with inline styles. If you're using a map to represent your styles, you can't define multiple values for the same key. For example, if you wanted to use flexbox, you'd need "display: flex" and "display: -webkit-flex". Solving that with inline styles is going to get messy. It's much easier to use less's auto-prefixer plugin to do that for you.
You need a stylesheet to define keyframe animations.
There's probably more I've missed, but those were the problems I ran into when I experimented with inline styles. In the end, the vender prefixes problem made me move all of my styles to a stylesheet. The good news is that the problem could probably be solved by applying a runtime equivalent of less's auto-prefixer.