News for hackers. Stuff that matters.
Re:CSS Diner by shittyanalogy on Tuesday March 25, 2014 @02:09AM (#7464166)
Very cool.

Possible bug: on level 19, :nth-last-child() doesn't seem to work for selecting the first child in a set of children in firefox. Running

    $("bento:nth-last-child(2)").length
is coming up 0 in the console as well.

edit: these work though :/

    bento:nth-last-child(even)
    bento:nth-last-child(1n+2)
    bento:nth-last-child(2n+0)
edit 2: Ahh figured it out. :nth-last-child doesn't match only nodes that satisfy the selector you called it on. It matches all sibling nodes of the selector you called it on.

edit 3: Actually, I don't know what I'm doing. It might be a bug. I can't tell anymore. Anyone else have any thoughts?

edit 4: OK, I finally get it... nth-last-child() is a qualifier not a grouper(I don't know the actual css terms so I made those up). That is to say that when you specify bento:nth-last-child(2) you're not saying "of all the bentos give me the second one" you're saying "of all the bentos give me those that are in the second child position."

Re:CSS Diner by kang on Tuesday March 25, 2014 @02:40AM (#7464259)
Came here to report level 19 as well.

According to the description on level 18

    div p:nth-child(2)
selects the second <p> in every <div>

So on level 19, to select the first <bento> in <div>,

    div bento:nth-child(1) 
should work, but it doesn't. However,

    div bento:nth-child(2)
works. So I think a possible bug here?
Re:CSS Diner by chc on Tuesday March 25, 2014 @03:41PM (#7468391)
The description of :nth-child is misleading here. It would only do that if the first two elements in every DIV were P elements. A more accurate description would be "Selects the second element in each DIV if it is a P." The description given there sounds more like :nth-of-type.
Re:CSS Diner by pippy on Tuesday March 25, 2014 @03:45AM (#7464446)

    .table *:nth-last-child(4)
Seems to work, although for me I had to push enter a few times.
Re:CSS Diner by kremlin on Tuesday March 25, 2014 @04:38AM (#7464610)
bento:nth-last-child(4) worked for me.

It selects the <bento> element that is the 4th child from last.

I think the confusion is here: people think that bento:nth-last-child(2) will be the solution because it should select the second-from-last bento element, but what it does is it selects all bento elements which are the 2nd from last children -- and since in the puzzle there is no bento that is second from last, it selects nothing.

So you have to consider it's siblings. The one we want ot select is the 4th-from-last among its siblings.

Re:CSS Diner by CoryMathews on Tuesday March 25, 2014 @10:14AM (#7465956)
That makes very little sense.

Adding the bento: should have removed all the other items from selection.

It sounds like you are explaining a selector such as *:nth-last-child(4)

Re:CSS Diner by kremlin on Tuesday March 25, 2014 @01:43PM (#7467436)
it in fact works the way that 'makes very little sense'.

There is a good reason, though, and it's in keeping with the 'nth-of-type' selector logic: there is a selector that works the way you think, called nth-last-of-type[0]

[0] http://www.w3schools.com/cssref/sel_nth-last-of-type.asp

[sample page I made just for you on my github.io page] http://flanneljesus.github.io/

Re:CSS Diner by kremlin on Tuesday March 25, 2014 @12:18PM (#7466761)
i haven't tested it in actual html/css. I'll do that now. I'll get back to you with my results
Re:CSS Diner by jsight on Tuesday March 25, 2014 @10:13AM (#7465944)
I also had to hit enter several times on a few of these. It looks like there are some bugs on a few of them.
Re:CSS Diner by samelawrence on Tuesday March 25, 2014 @01:03PM (#7467087)
TIL * from CSS where known.previous == didntKnowShit

I learned a lot today. Thanks for posting this in the thread.