Skip to content

Instantly share code, notes, and snippets.

@humbertodias
Last active April 17, 2024 17:48
Show Gist options
  • Star 13 You must be signed in to star a gist
  • Fork 17 You must be signed in to fork a gist
  • Save humbertodias/b878772e823fd9863a1e4c2415a3f7b6 to your computer and use it in GitHub Desktop.
Save humbertodias/b878772e823fd9863a1e4c2415a3f7b6 to your computer and use it in GitHub Desktop.
CSS Diner Solutions
http://flukeout.github.io/
#01 plate
#02 bento
#03 #fancy
#04 plate > apple
#05 #fancy pickle
#06 .small
#07 orange.small
#08 bento > orange.small
#09 plate, bento
#10 *
#11 orange.small, pickle, plate > apple
#12 plate + apple
#13 bento ~ pickle
#14 plate > apple
#15 plate orange:first-child
#16 plate *:only-child
#17 #fancy *:last-child , plate + pickle
#18 plate:nth-child(3)
#19 bento:nth-last-child(3)
#20 apple:first-of-type
#21 plate:nth-of-type(2n)
#22 plate:nth-of-type(2n+3)
#23 plate apple.small:only-of-type
#24 orange:last-of-type , apple:last-of-type
#25 bento:empty
#26 apple:not(.small)
#27 [for]
#28 plate[for]
#29 [for="Vitaly"]
#30 [for^="Sa"]
#31 [for$="ato"]
#32 [for*="obb"]
@flukeout
Copy link

flukeout commented Jun 7, 2017

🍎 🍊 🍱

@porcoespinho
Copy link

As of 08/31/2017: #19 was bento:nth-last-child(3)

@qedpro10
Copy link

qedpro10 commented Sep 2, 2017

#27 [for]
#28 plate[for]
#29 [for="Vitaly"]
#30 [for^="S"]
#31 [for$="o"]
#32 [for*="bb"]

@DoSDa
Copy link

DoSDa commented Sep 27, 2017

#08 bento > orange

,- wrong

@JBeni
Copy link

JBeni commented Oct 23, 2017

#08 bento > orange.small

@tejveeerboparai
Copy link

how is 27 [for]
it works but why?

@mutheusalmeida
Copy link

#27 bento:empty selects all bentos that have no children: the first one and the last one

@sebahsr
Copy link

sebahsr commented Dec 14, 2018

#27 [for]
#28 plate[for]
#29 [for="Vitaly"]
#30 [for^="Sa"]
#31 [for$="ato"]
#32 [for*="obb"]

@GlenjaminDanks
Copy link

#8 is wrong. bento > orange.small

@wbdvlprdrm
Copy link

#19 bento:nth-last-child(3)

@Paulmohabir88
Copy link

i'm trying to figure out number 19 i don't understand why the nth-last-child is 4
I know we're trying to identify the right most thing in css
so i thought it would be 1

@corisco33
Copy link

i'm trying to figure out number 19 i don't understand why the nth-last-child is 4
I know we're trying to identify the right most thing in css
so i thought it would be 1

Here you must try to select one of the siblings inside a given element by counting from the end.

The solution showed here is wrong; it should be: bento:nth-last-child(3)

This will select the bento that is the 3th (child) element within the (parent) div element when you count from the bottom up.

@i-rahulkashyap
Copy link

#8:bento orange.small

@vamshikrishnafive
Copy link

#19 plate + :nth-child(2)

@gcodergit
Copy link

#24
.small:last-of-type

@sadatakhtar
Copy link

#12 plate + apple

Copy link

ghost commented Jul 8, 2020

#19 . corrections : it's actually : [ bento:nth-last-child(3) ] not (4)

@kingsfull123
Copy link

#19 incorrect. should be bento:nth-last-child(3)

Copy link

ghost commented Aug 2, 2020

#21 plate:nth-of-type(even)

@whdgur8589
Copy link

#11 plate > *

@antuq
Copy link

antuq commented Sep 3, 2020

.small:last-child is my right answer for 17 . How?

@WondwosenTsige
Copy link

WondwosenTsige commented Nov 1, 2020

#32 [for*="ob"]

@diegop1703
Copy link

#21 plate:nth-of-type(even)

#21 plate:nth-of-type(even)

Thanks

@Nystein
Copy link

Nystein commented Sep 15, 2021

12: plate + apple.

Would someone mind elaborating on this? I don't quite understand this one.

@023-19-0040
Copy link

this also works..
16)plate apple, plate orange

@q92helea
Copy link

Why is the answer to question #13 not 'pickle~pickle'?

@BallBoychick
Copy link

this also works.. 16)plate apple, plate orange

  1. plate :only-child

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment