+ 1
btn:nth-child(1) means - Select every <button> element that is the first child of its parent. The buttons are not siblings they don't share the same parents. The first button in your html is the third child of its parent: <body> The second button in your html is the first child of it parent:<div> To get the first button to include the "Start Game" try 3
1st May 2022, 3:43 AM
ODLNT
ODLNT - avatar
+ 2
Enzo Wong [Active] No probs šŸ‘, I'm glad I could help.
1st May 2022, 6:11 PM
ODLNT
ODLNT - avatar
+ 1
Try btn:nth-child(1):after(3) to access the first button
1st May 2022, 3:54 AM
CalviÕ²
CalviÕ² - avatar
+ 1
Just curious why not just put the text on the button? <button> Start game </button> Since both buttons have the same class, why do you need nth If you're just going to style them the same anyway?
1st May 2022, 4:23 AM
Chris Coder
Chris Coder - avatar