Here's Some Important Things To Know About CSS and HTML.

In web design, class names are used to describe certain properties of a piece of HTML coding. Although class names and HTML IDs are similar, you don't need to be as careful with class names and they are much weaker than HTML IDs. Some elements of HTML may have one or more class names, while others might have none at all. Using Javascript, this makes class names not as reliable or as useful as IDs when identifying a given element of HTML. Class names are used most commonly in CSS. Some class names found on the internet appear weird, however, such as Reddit. If you inspect the Reddit website, for instance, you will find that the website's class names seem to be sequences of random letters. Why aren't these class names more descriptive?

One Reddit user claims that this is how Reddit avoids CSS clashing. If one component uses .title to name a specific post, for example, then another uses .title to name the sidebar information, Reddit's web designers would need a much deeper scope. Otherwise, there would be a clash in the site's CSS coding. Reddit most likely uses .title, then randomizes another class name when pages are built.

Little to no performance is lost by changing the class name from .title to using CSS modules, but the real advantage to Reddit's approach to class names involves less overhead regarding style names and conventions. This method requires no use of BEM CSS, and, in fact, using BEM has the potential to run into name clashes. In this case, you would use the class name, .item__title--fancy, then someone else will use it too. In order to avoid using longer class names, which will negatively affect a site's performance, you can opt to use CSS modules, wherein web designers don't really have to care about the issue as much. For more information click here https://www.reddit.com/r/web_design/comments/aat7l7/why_are_class_names_so_weird_on_reddit_website/.