Search posts, tags, users, and pages
Oh gosh, that's one heck of a class^^ I went the other direction at some point, having classes like
.w100 {
width: 100px;
}
.h50p {
height: 50%;
}
.cR {
color: red;
}
Really scary stuff >.<
PS.: DO NEVER DO THAT!!!
Funny enough, there's an entire framework that does this. http://tachyons.io/docs/table-of-styles/
I think the above class is not weird. It's good. It is a good helper class.
@sunnysingh yeah, there was some kind of movement of nano CSS names and composing CSS inside the HTML tags' class attribute and I didn't know not to trust the Internet on that
@maruru Not sure how I feel about it, but I'm not completely against it. For React apps, I can see how this isn't any different from inline styles (which works well for component architectures), and is kinda better because you're reusing utility classes. I still personally prefer semantic classes (header instead of m10 f21) but would love for someone to explain how Tachyons can be used effectively.
@maruru Hmm..if you own the code only, no one will read your code, it is okay. However, if your code builds a library/framework or even your code is open to public, then you must follow the correct naming convention.
@billyhalim All code should be written in a way that it is very readable to any third party, because sometimes you leave your code for a few years and when you come back, you will be like a third party and you will hate yourself and you will throw everything away and have to redo it or take just as long to figure out what you did back then and fix all the problems which pop up during implementation of new features.
@maruru Yes, you're right. Thanks by the way.
@maruru Hmm...I forgot something. In my opinion, your last comment is not really important for CSS libraries or frameworks because the CSS classes abbreviation and function are well documented. Frameworks/Libraries won't make your code more readable. However, your task is to make your code readable.
Let's say Bootstrap. Bootstrap has a grid system with classes like .col-lg-, .col-md-, .col-sm-*. Those classes are not understandable unless you have read the documentation. Before we read the docs, we don't know that lg, md, sm are breakpoints.
@billyhalim yeah, but those are three abbreviations, while for this kind of nano-names you would have to know every single class. That's no good. I like intuitive naming conventions.
@maruru What do you mean by nano-names ?
@billyhalim the kind of names you see in my post
@maruru Owh...but I think if they are documented well, there will be no problem. However, I don't like that name convention instead I will use hyphen to separate every words and numbers. For example, w-100, h-50-p