News for hackers. Stuff that matters.
Re:What No One Told You About Z-Index by faramarz on Tuesday January 15, 2013 @04:35PM (#5063165)
But I got the same result by assigning z-index 2 and 3 to the other colors.

So the results is the same, but the method is incorrect? does it matter? hmm

http://codepen.io/anon/pen/DlyAv

Re:What No One Told You About Z-Index by aroman on Tuesday January 15, 2013 @04:50PM (#5063267)
I don't really want to add to the dogpile of comments explaining why you missed the point, but the blog post pretty clearly states what the criteria for the "challenge" were:

"Here's the challenge: try to see if you can make the red <span> element stack behind the blue and green <span> elements without breaking any of the following rules:

Do not alter the HTML markup in any way. Do not add/change the z-index property of any element. Do not add/change the position property of any element."

Re:What No One Told You About Z-Index by recursive on Tuesday January 15, 2013 @06:03PM (#5063728)
He didn't change the markup. He changed the CSS. He didn't add a property to an element. He added a property to a rule.
Re:What No One Told You About Z-Index by mistercow on Tuesday January 15, 2013 @06:33PM (#5063899)
He didn't add a property to a rule. He entered text in the CSS editor.

He didn't enter text in the CSS editor. He pressed some buttons on a keyboard.

We could keep at this for a while, if you want.

Re:What No One Told You About Z-Index by aroman on Tuesday January 15, 2013 @10:51PM (#5065136)
Yeah I'm really not sure what you're trying to say. He explictly set the z-index on the elements by editing the CSS. It wasn't the inherent act of editing the CSS that was the violation -- explicitly setting the z-index was.
Re:What No One Told You About Z-Index by taeric on Tuesday January 15, 2013 @04:40PM (#5063209)
The point was that you can "alter the z-index" without actually altering the z-index. At least, that was my takeaway.
Re:What No One Told You About Z-Index by philipwalton on Tuesday January 15, 2013 @04:44PM (#5063236)
The point was that there are factors other than z-index involved in determining the stacking order. I'm certainly not suggesting anyone use opacity to move things around in the stacking order. I was just trying to make people aware of it. It's confusing if you don't know what's going on.
Re:What No One Told You About Z-Index by Argorak on Tuesday January 15, 2013 @04:43PM (#5063231)
The point was to illustrate the stacking behaviour introduced by opacity, not how to trivially arrange 3 elements using z-index.
Re:What No One Told You About Z-Index by dazmax on Tuesday January 15, 2013 @04:40PM (#5063213)
The point of the example was to show how something other than z-index, position, and order can affect stacking. It wasn't demonstrating the correct way to go about changing the stacking order.
Re:What No One Told You About Z-Index by khwang on Tuesday January 15, 2013 @04:49PM (#5063263)
The point of this exercise was to show that opacity has an effect on element position, which was surprising to me! It matters because it might fix a z-index bug you have one day (:
Re:What No One Told You About Z-Index by bunkat on Tuesday January 15, 2013 @04:40PM (#5063208)
This is what I did as well. Seems to make more sense to me than putting an odd opacity value on an element.