But of course it would be better if your css classes represented semantic meaning rather than just floating-left for no reason. (Like floating-menu or something like that)
For me personally it really depends. I like to style using custom classes for elements in the app, but I also find value in these single purpose classes.
When people have these debates they usually go either 100% to one side or the other. I don't really see people mention a combination of both approaches.
float-left as a name has a lot of sense here because it only has that purpose. If you called it floating-menu and it only has that one purpose, how would you use that class with something that isn't a menu, maybe a card? You would create a floating-card class that has this same property? Thus repeating yourself.
you have a floating menu its essentially a "menu".. so everything that is a menu has its properties.
If you put the actual non-semantic properties on it then its unclear which "float-lefts" you would need to change and which remain. Ie. it lacks abstraction and meaning. You've simply put the implementation without indicating the intention.
They are different things, but it doesn't mean they cannot share some of the same behavior. As I've said, I don't support putting everything in utility classes, but I see the use case for some of them.
I see your point, but these utility classes usually have quite understandable names. float-left is kinda self explanatory. To be honest, I kinda like both of both worlds. I style mostly with semantic class names, creating "components" using BEM, but I also sprinkle some utility classes here and there, it's just a matter of preference.
EDIT: I might have gone a bit off topic here. If I return to the context of "If you are using Bootstrap, don't override behavior with custom classes if there are utility classes already available to you" and that's a point I agree with.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
But of course it would be better if your css classes represented semantic meaning rather than just floating-left for no reason. (Like floating-menu or something like that)
For me personally it really depends. I like to style using custom classes for elements in the app, but I also find value in these single purpose classes.
When people have these debates they usually go either 100% to one side or the other. I don't really see people mention a combination of both approaches.
float-left as a name has a lot of sense here because it only has that purpose. If you called it floating-menu and it only has that one purpose, how would you use that class with something that isn't a menu, maybe a card? You would create a floating-card class that has this same property? Thus repeating yourself.
but aren't they different things?
you have a floating menu its essentially a "menu".. so everything that is a menu has its properties.
If you put the actual non-semantic properties on it then its unclear which "float-lefts" you would need to change and which remain. Ie. it lacks abstraction and meaning. You've simply put the implementation without indicating the intention.
They are different things, but it doesn't mean they cannot share some of the same behavior. As I've said, I don't support putting everything in utility classes, but I see the use case for some of them.
I see your point, but these utility classes usually have quite understandable names.
float-left
is kinda self explanatory. To be honest, I kinda like both of both worlds. I style mostly with semantic class names, creating "components" using BEM, but I also sprinkle some utility classes here and there, it's just a matter of preference.EDIT: I might have gone a bit off topic here. If I return to the context of "If you are using Bootstrap, don't override behavior with custom classes if there are utility classes already available to you" and that's a point I agree with.