My favorite upcoming CSS feature

4 views
Skip to first unread message

Daniel

unread,
Jun 20, 2012, 10:44:50 PM6/20/12
to arch-r...@googlegroups.com
CSS variables! This is going to make stylesheets way easier to build. Instead of repeating multiple instances of the same color throughout a stylesheet, I can just say $primary_color. And, if my text should happen to have the same color, but I don't want to change it while I'm changing the primary color, I won't be cornered in by the limitations of find and replace.

And this is going to make automation easier, too. Stylesheets generated by software only need to worry about a few different variables, rather than having to manage several instances throughout an arbitrary stylesheet, resulting in fewer bugs. This has immediate implications for customizable themes in CMSs like Drupal and Wordpress.

P.S,
Yes, I know what SASS and LESS are. I'm still happy that this about to become "native" functionality that doesn't need a preprocessor, though.

Pete L.

unread,
Jun 20, 2012, 11:05:16 PM6/20/12
to arch-r...@googlegroups.com
Yeah, I have very mixed feelings about CSS variables. I think that this functionality could have been better handled with CSS-based inheritance. Think:

.blueText { color: blue; }
.bold { font-weight: bold; }
.link { extends: .blueText; text-decoration: none; }
h1 { extends: .blueText, .bold; border-bottom: 1px solid black; } 

I'm not sure that would have been any harder to implement, and it would have been a more reasonable approach to shared properties. CSS in general is pretty uninspired. It usually turns into a huge mangled mess of selectors and properties that are difficult to maintain and require a good working knowledge of complicated precedence rules to actually sort out. There are also performance considerations that become apparent when working with low power devices that can be really frustrating to figure out because those devices often don't come equipped with the kind of robust developer tools needed to actually determine what's causing the performance issue. So you not only need to know the complicated precedence rules, but you need to be aware of how the actual browsers get implemented so that you can avoid performance pitfalls. So yeah, I'm not a huge fan of CSS in general. And I think that adding variables to the mess will just encourage people to do more obnoxious things with it.  

Personally, my favorite CSS3 feature is CSS animations. They allow for huge increases in animation performance in mobile devices by providing the necessary information for the browser to offload animation rendering to the GPU. Sadly, IE9 does not support CSS animations, but IE10 does. So once everyone upgrades to Win8 we'll be in business.

-Pete



--
You received this message because you are subscribed to the Google Groups "Arch Reactor" group.
To post to this group, send email to arch-r...@googlegroups.com.
To unsubscribe from this group, send email to arch-reactor...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/arch-reactor/-/GadDlwoNU6oJ.
For more options, visit https://groups.google.com/groups/opt_out.

Reply all
Reply to author
Forward
0 new messages