News for hackers. Stuff that matters.
Re:CSS background image hacks by NIL8 on Friday January 21, 2011 @10:59AM (#2127690)
Very nicely put together. The layout presents your information in a smooth and inviting way while providing some really nifty instruction. Most sites offering info similar to yours are very cluttered and distracting. I hope you'll consider doing more of these.
Re:CSS background image hacks by necolas on Friday January 21, 2011 @12:29PM (#2128041)
Thanks. I try to do all my write-ups like this because it also helps me better understand the subject.
Re:CSS background image hacks by nborgo on Friday January 21, 2011 @11:42AM (#2127851)
I usually use padding on an element to show a background image to the left of it, but the pseudo background-crop looks pretty great. Definitely going to use that one.

Is there anything stopping me from animating the background rotation with jQuery? That would add to the accordion effect if it works.

Re:CSS background image hacks by necolas on Friday January 21, 2011 @12:33PM (#2128064)
If you want that sort of effect then you'll have to rely on DOM elements in some form.

Because the pseudo-elements aren't part of the DOM, you can't use jQuery to animate the rotation. At the moment, CSS animations and transitions can't be applied to CSS pseudo-elements either.

Re:CSS background image hacks by bzbarsky on Friday January 21, 2011 @10:25PM (#2129817)
Gecko is just fine with applying CSS transitions to pseudo-elements. Try this testcase:

data:text/html,<style>div::before { color: green; content: "text"; } div:hover::before { color: red; -moz-transition-duration: 5s; }</style><div>

It does look like Webkit doesn't support this, though. Which is a bug, per the current spec draft. All the transition stuff is specced to apply to ::before and ::after.

Re:CSS background image hacks by necolas on Saturday January 22, 2011 @07:10AM (#2130329)
Not sure what you mean. I've tested transitions in Firefox 3.6 and they are not supported - http://jsfiddle.net/qPdeV/
Re:CSS background image hacks by bzbarsky on Saturday January 22, 2011 @11:35PM (#2131788)
3.6 doen't support transitions at all, correct. 4 supports transitions, including on ::before and ::after.
Re:CSS background image hacks by necolas on Sunday January 23, 2011 @12:37PM (#2132858)
Right. But Firefox 4 is still in beta, making it a bit misleading to say "Gecko is just fine".