Code working, but returning "Oops, make sure..." [8. Changing your style]


$("div").css("height", "200");
$("div").css("width", "200");
$("div").css("border-radius", "10px");

I'm getting: "Oops, try again. Make sure to use the .height() function in your code" for exercise: "Modifying HTML Elements - 8. Changing your style"

But, height seems to be properly set to 200px using above.

A similar error happened on the previous exercise, which also seemed to be working fine.
Any help will be much appreciated.


This is new. In the thousands of times this question has come up, it's always been the reverse scenario... border-radius as a method. This time it's height and width as CSS properties. Finally another angle from which to view the exercise...

Starting things off, CSS does not understand unitless values for about 99.9% of its properties. z-index is one of how many? That the jQuery method interprets the unitless value is an added bonus.


jQuery will add the missing units. But it's okay if write them in. These are the two lines the SCT is expecting ('div') of course. The border though, you have the code it takes. There is no convenience function for that.


Thank you - I had to read this a couple times, but it makes sense now.
Appreciate it!


6 posts were split to a new topic: Don’t understand other answers

Don't understand other answers