My code works, but it says it's wrong

I am working on the Responsive Web Design course, specifically the Basic CSS section. I have been tasked with different activities where I have to change the font or color of an element. In all of them, I did what it asked correctly as I could see it reflected on the website. However, it marked the activity as wrong. This has happened with several tasks but I will show only one here as an example for the sake of length.

As you can see on the picture below, I have done what it asks me and the code works, as the div element is silver. I have read a post about this from 3 or 4 years ago, where people had this exact problem. Some posted solutions, which required me to code it in a different way. I have, and none of that has worked.

Picture with the code and the website (I wasn’t allowed to upload the picture as apparently new users can’t, so I had to upload it to another website, sorry for the troubles.)

The solution in the end was to spam “Run the Tests”. After many clicks, it passed the test. I’ve had to do this for different parts of the CSS Basics sections, where I had to recolor element and etc. The only way was this solution, so there must be some kind of error here. I am using Google Chrome Version 92.0.4515.131 (Official Build) (64-bit) on Linux Mint. I tried this again on another computer, Windows 10 with Version 92.0.4515.159 (Official Build) (64-bit). The only way to not have this problem has been to use another browser, in my case Firefox has worked. This is a big problem in my opinion, and I hope they will do something about it.


Hi and welcome to the forums, there’s nothing wrong with the tests, the error in the screenshot you posted is that your div has a class of silver-brackground (notice the typo). If you have a problem with a particular challenge, it’s best to click the “get a hint → ask for help” button to open a forum post about it. Sometimes, browser extensions like dark mode can interfere with the tests, because they change the CSS, sometimes ad blockers cause a test to fail erroneously. I’d recommend that next time this happens to you, just open a thread here to double-check if it’s a problem with your code or a problem with the browser.

Thank you for the reply, I feel very embarassed about that typo! However, this was not the only case. I don’t deny the possibility that it might have been a typo, but I have had 2 cases where it was not a typo (I checked very thoroughly with other people as well) and simply spamming the Run the Tests button made it go correct. Maybe it was just a one time error, but just in case I wanted to post it here in case it could help.

I’m not sure how it’s possible that hitting the button again and again will suddenly make the tests pass… there’s threads here every day about how a challenge doesn’t pass, and in 99.99% of cases it’s either an error in the code or an issue with the browser. But anyway - next time you encounter such a situation, here’s a list of stuff to try:

  • make sure the browser is up to date
  • disable all browser extensions
  • clear browser cache
  • try incognito mode
  • try a different browser
  • if nothing works, open a thread here

I think the reason for the problems it was giving me might’ve been because I had a dark mode extension enabled. I am not using it now and I have no problems, I somehow missed the part where it advised about this possible issue.

If I’m not mistaken, that hint (you mean the blue box here: courses overview page?) was added rather recently, so there’s a good chance it didn’t exist when you started the curriculum. It was added because many people came to the forums being frustrated because their correct code didn’t pass.

I believe you’re right, I don’t think it was there. But I remember reading something about it, I think on the project odin website, which is why I said it. Glad they have added it, it will avoid repetitive posts in the forums like mine haha.

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