Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS CSS Foundations Text, Fonts, and Lists More Text Properties

Zakher Masri
Zakher Masri
4,415 Points

if the class name selected and the property added to it are the same

While using TeamTreeHouse workspace I selected the "text-overflow" class and then added the "text-overflow" property and assigned a value to it. The value was implemented but I got a little bit confused because the "text-overflow" property was highlighted in red as if there's an error in it. I figured maybe because the property's name is the same is the selected class. Though it worked. Is it a good practice to avoid creating classes with names similar to css properties?

.text-overflow {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

1 Answer

Hi Zakher, I think you intuitively got this. Yes, it will work but creates confusion. Code can get complicated, so anything we can do to avoid confusion is good. I'm guessing that is why the site highlighted it.

You have a good intuition.