Jump to content

wrong answer in CSS exercise


Reisgaar

Recommended Posts

Hi, maybe you have noticed yet, but just in case:

in the CSS tutorial, in the exercise 3 of "CSS text" ( https://www.w3schools.com/css/exercise.asp?filename=exercise_text3 ), when you give the correct answer it returns "Link has wrong text decoration", even copying the answer gived by the tutorial, it returns the same answer.

Link to comment
Share on other sites

  • 4 weeks later...

Be aware that the recent version of Firefox is having some issues with some of the exercises. As an alternative, Chrome works just fine on this question.

  • Like 1
Link to comment
Share on other sites

9 hours ago, Ingolme said:

Right, blame the fox.

I just tried in Chrome and it works but Firefox reports an error. This is weird that this is browser independent. Mind= blown.

Link to comment
Share on other sites

16 hours ago, Ingolme said:

Right, blame the fox.

Oh no, Ingolme!!!

7 hours ago, Steven1 said:

I just tried in Chrome and it works but Firefox reports an error. This is weird that this is browser independent. Mind= blown.

It seems to be an interesting behaviour of window.getComputedStyle() and getPropertyValue("text-decoration")

Its important to note, that the exercise checks for the existence of none inside this property value.

On Firefox, when you've defined the text-decoration as none it actually removes the text-decoration-line(default: underline) and text-decoration-style(solid) keywords from the text-decoration property value. So you're only left with the text-decoration-color. Hence the process fails.

On Chrome, text-decoration is property that seems to be directly combined from text-decoration-linetext-decoration-style, and text-decoration-color. Hence none exists, the process succeeds, and the question is marked correct.

If the question checked for text-decoration-line instead of generic text-decoration, this question would no longer be an issue.

I agree, this is very interesting stuff!

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...