https://www.freecodecamp.com/challenges/use-a-css-class-to-style-an-element
The class names .blue-text and .red-text are used, the student is being asked to unnecessarily use colours specifically in the class names which is bad practice. The lesson even requires the student to modify the class name, only because a color name has been used. Instead, the class name should be something agnostic of the color used such as .main-text or similar, meaning that the student learns to maintain only the style value and not the style's underlying class selector unnecessarily.
@tombatnz thanks for the issue. Although I would agree with your argument, we've had similar discussions on whether to show best practices or not. From what I remember, we agreed on focusing more on just teaching students how HTML (or whatever concept) works.
Quote from @BerkeleyTrue
On top of that, challenges are meant to teach specific concepts and not necessarily teach best practices.
cc/ @FreeCodeCamp/issue-moderators
I'd agree with @erictleung, I think the specific class names are useful for linking the style definition and class assignment together in the user's mind, and showing what the style rule is for and how it works. As an introduction to the concepts it works well, and best practices can be developed with more practice.
Yeah, we should ideally switch to using more logical naming for the classes.
@erictleung @BKinahan Are correct, challenges are meant to teach a specific concept. Best practices are not something we should teach at such an introductory level.
Happy Coding.
Most helpful comment
I'd agree with @erictleung, I think the specific class names are useful for linking the style definition and class assignment together in the user's mind, and showing what the style rule is for and how it works. As an introduction to the concepts it works well, and best practices can be developed with more practice.