Bug in "Show it if you know it"?


#1

I think there is a bug in the "visualizer" screen on the right side of the page for this exercise: https://www.codecademy.com/en/courses/web-beginner-en-WF0CF/3/5?curriculum_id=50579fb998b470000202dc8b

This is what I have in my CSS. But on the screen, only the 2nd link has a changed color, not the 3rd. I also tried changing the font-family. It also only affected the 2nd link.

a:nth-child(3) 
     color: #FFC125;
}


#2

can you post your html code?

did you use breaks? (<br>)? nth-child count all elements, but i need to see your code to be able to explain it properly


#3

Yes, I used <br>.

<body>
   <a href="http://somelink.com">Link 1</a><br>
   <a href="http://notgoogle.com">Link 2</a><br>
   <a href="http://anotherlink.com">Link 3</a><br>
</body>

#4

so break is now the second element, and the second link the third element. nth-child counts all elements, so it makes sense the second link get the color

So not really a bug?


#5

interesting. didn't know that. thanks!

when I hit submit, it said that my code satisfied the requirements for that exercise. that was what gave me the impression that there was a bug.


#6

yea, but here is the catch, lets say we have this:

<body>
  <h1>heading</h1>
  <p>paragraph</p>
</body>

and then do this:

p:first-child {color: red}

nothing will color red, since the first element is a h1 heading, not a paragraph

you wrote the required code in the css file, the code which has to be written is validate, if you add more (like breaks in html) this won't be validated


#7

that makes sense, and I appreciate your clarification. the disjunction between what the exercise tells the user to accomplish, and what is validated in the code is still a little confusing. like when I do

a:nth-child(5) { color: #FFC125 }

I successfully changed color of the 3rd link, but it's not an acceptable answer. from a user experience perspective, the behavior of the app seems strange. and it's not just me. looks like other people have been baffled by the same thing. just wanted to provide this feedback in case you're interested.


#8

Makes sense that the answer is not accepted? The problem is that if you allow all creativity from students (like adding breaks, and much more) the checking becomes impossible complex.

So added more content then the exercise asks for, so then a conflict between code validated by the exercise and the output arises, not much we can do about that.


#9

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.