News for hackers. Stuff that matters.
Re:Fancy Buttons - Customize Buttons Effortlessly with CSS3 ... by tptacek on Friday November 20, 2009 @02:46PM (#953209)
We do something similar, but vastly more evil, with Compass on our product. We need the visual experience to be solid on IE (our customer base is enterprise). So... we generate and cache PNG's with ImageMagick using hooks we wrote into Sass. For instance, we can specify arbitrary gradients using Sass color variables and direction/distance arguments, auto-gen rounded corners, and in some cases render text using non-browser-safe type.

I wouldn't recommend the approach (I think it's going to be incredibly clunky in a year or so, and that things like Fancy Buttons that use Compass to hide the complexity of optimal degrading CSS are the way to go), but it is an example of how flexible Compass and Sass are: you can abuse them terribly, and they'll stay loyal.

Re:Fancy Buttons - Customize Buttons Effortlessly with CSS3 ... by imathis on Friday November 20, 2009 @03:32PM (#953339)
Fascinating, thanks for sharing your experience. Pixel perfection certainly is a tempting goal, but I've spent too much time and other people's money trying to preserve the illusion that IE is anything less than garbage. I've had enough. Now I'm more focused on usability and I find it far more rewarding.
Re:Fancy Buttons - Customize Buttons Effortlessly with CSS3 ... by snprbob86 on Friday November 20, 2009 @08:56PM (#953976)
Yeah, this is a point that many people neglect. It just needs to work in IE. It doesn't need to be pretty. And if you have enough customers on IE that it needs to be pretty, it doesn't need to match the real pretty exactly.
Re:Fancy Buttons - Customize Buttons Effortlessly with CSS3 ... by chriseppstein on Friday November 20, 2009 @02:15PM (#953099)
This plugin is such a great example of how to use compass and sass to build simple abstractions out of some of the most complex css that exists.
Re:Fancy Buttons - Customize Buttons Effortlessly with CSS3 ... by jp_sc on Friday November 20, 2009 @02:45PM (#953206)
A few CSS3 rules on a single element isn't something I would call "the most complex css that exists".

EDIT: I do like compass and this plugin.

Re:Fancy Buttons - Customize Buttons Effortlessly with CSS3 ... by tptacek on Friday November 20, 2009 @02:49PM (#953216)
It's CSS3 that degrades beautifully in IE and controlled by 2-3 lines of styling. What more do you want?
Re:Fancy Buttons - Customize Buttons Effortlessly with CSS3 ... by tdavis on Friday November 20, 2009 @03:03PM (#953266)
I think his point was simply that writing such CSS is hardly complicated. I like this abstraction and think it will be pretty handy for Compass users (of which I plan to become one), but this mixin basically reduces ~8 lines of CSS to two.
Re:Fancy Buttons - Customize Buttons Effortlessly with CSS3 ... by imathis on Friday November 20, 2009 @03:54PM (#953387)
As far as amount of css goes, here's what you're dealing with to achieve something similar in only CSS.

  1. Button reset - to get browsers to the same starting point
  2. Rounded corners, Text shadows, and Gradients + vendoring
  3. Background image fallback
  4. Padding, Text size, line-height, etc
  5. Default, Hover, and Active states for all styles
That's a lot of css to write, effectively reduced to a single mixin. Of course, it's also great that you can use the bare minimum html.
Re:Fancy Buttons - Customize Buttons Effortlessly with CSS3 ... by chriseppstein on Friday November 20, 2009 @04:36PM (#953472)
And there's a ton of color math going on.
Re:Fancy Buttons - Customize Buttons Effortlessly with CSS3 ... by tptacek on Friday November 20, 2009 @03:04PM (#953270)
If I had been less snarky I might have communicated my question better, which is, what's the CSS pattern that's more complicated? It'd be a good candidate for a Compass plugin.
Re:Fancy Buttons - Customize Buttons Effortlessly with CSS3 ... by treyp on Saturday November 21, 2009 @01:33AM (#954278)
It should be noted that CSS gradients are not yet supported in Firefox (3.5). As such, this demo uses transparent PNGs instead of of CSS3 properties. It works fine in this case, but of course images aren't as flexible as CSS properties would be.

However, Firefox 3.6, which should be released within a few weeks, will support custom gradients, so things are looking up.

Re:Fancy Buttons - Customize Buttons Effortlessly with CSS3 ... by newsio on Friday November 20, 2009 @04:06PM (#953408)
Excellent little demo.

Shows how long I've been out of touch with CSS. Didn't know stuff like variables or rounded edges was supported.

Re:Fancy Buttons - Customize Buttons Effortlessly with CSS3 ... by pohl on Friday November 20, 2009 @04:13PM (#953426)
The variables appear to be a SASS construct, not CSS.

http://en.wikipedia.org/wiki/Sass_(stylesheet_language)

Re:Fancy Buttons - Customize Buttons Effortlessly with CSS3 ... by imathis on Friday November 20, 2009 @04:28PM (#953460)
SASS compiles to CSS.
Re:Fancy Buttons - Customize Buttons Effortlessly with CSS3 ... by smanek on Friday November 20, 2009 @05:57PM (#953663)
And it inlines the variables as constants at 'compile time'.
Re:Fancy Buttons - Customize Buttons Effortlessly with CSS3 ... by ned on Friday November 20, 2009 @04:20PM (#953445)
Rounded corners are supported in Webkit Gecko and Presto, and not in Trident of course.

Variables are provided by SASS, a CSS pre-processor language/framework.

Re:Fancy Buttons - Customize Buttons Effortlessly with CSS3 ... by audionerd on Friday November 20, 2009 @03:03PM (#953269)
What does it look like in IE6? Just curious, if anyone has a screenshot.
Re:Fancy Buttons - Customize Buttons Effortlessly with CSS3 ... by imathis on Friday November 20, 2009 @03:36PM (#953353)
IE6 doesn't easily support png transparency. It basically just looks like a flat colored boxy button with a border.
Re:Fancy Buttons - Customize Buttons Effortlessly with CSS3 ... by chriseppstein on Friday November 20, 2009 @03:44PM (#953366)
I'd imagine that some future revision might enhance the support for IE6...
Re:Fancy Buttons - Customize Buttons Effortlessly with CSS3 ... by imathis on Friday November 20, 2009 @03:56PM (#953392)
Certainly. As far as IE6 support can go without compromising on simplicity.
Re:Fancy Buttons - Customize Buttons Effortlessly with CSS3 ... by bprater on Friday November 20, 2009 @03:23PM (#953313)
Are there any pure JS implementations of something like Sass/Compass?
Re:Fancy Buttons - Customize Buttons Effortlessly with CSS3 ... by chriseppstein on Friday November 20, 2009 @03:32PM (#953338)
There's http://github.com/clr/sassijs

But it's not feature complete yet.

Re:Fancy Buttons - Customize Buttons Effortlessly with CSS3 ... by fnid on Friday November 20, 2009 @02:41PM (#953191)
which browsers support this?
Re:Fancy Buttons - Customize Buttons Effortlessly with CSS3 ... by tptacek on Friday November 20, 2009 @02:43PM (#953196)
They all do, but things will look better in Firefox and Safari.
Re:Fancy Buttons - Customize Buttons Effortlessly with CSS3 ... by ltackett on Friday November 20, 2009 @02:13PM (#953090)
pimpy.
Re:Fancy Buttons - Customize Buttons Effortlessly with CSS3 ... by kyro on Friday November 20, 2009 @07:07PM (#953798)
handles
Re:Fancy Buttons - Customize Buttons Effortlessly with CSS3 ... by kyro on Saturday November 21, 2009 @01:52PM (#954771)
Yeah, I was just helping him correct a misspelling in the post, that still hasn't been caught.

"Here’s a sample of what CSS rules this mixin hanldes for you:"

Re:Fancy Buttons - Customize Buttons Effortlessly with CSS3 ... by imathis on Sunday November 22, 2009 @09:01PM (#956591)
Finally caught it. Thanks.
Re:Fancy Buttons - Customize Buttons Effortlessly with CSS3 ... by lessallan on Friday November 20, 2009 @02:16PM (#953106)
Compass FTW!