0
I am using the standard WELL and came to me a doubt, when I have an element with children and grandchildren, how should I name my classes?
I will use code to give this example:
<header class="header">
<div class="header__container">
<!-- BURGUER MOBILE MENU -->
<div class="header__burguer">
<img class="??????" src="burguer.png" alt="Menu Mobile">
</div>
</div>
</header>
The part of the image inside the header__burguer
that you’re confusing me,
if I use header__img
would be kind of meaningless, because img is too generic and use 4 underscores I think comes out of the pattern of WELL. header__burguer__img
Could anyone suggest something according to this pattern? Looking, I haven’t found anything yet.
This is a clear signal that is making your element more complex than it should be. If I create a "burger" button in the header and another in the footer, what are the differences? The button really needs to depend on header?
– Woss
In this case, it does not. In my conception I put the header_burguer because this element is inside the header. With your answer I see that I had understood so it has nothing to do, right?
– Lucas de Carvalho
Correct. You use GOOD for only its isolated element. By definition it cannot depend on the context that is inserted.
– Woss
actually on the footer would be something like
<footer class="footer">...
 <div class="footer__ burguer">
– hugocsl
Take a look at this answer, and especially the two links I mention at the end https://answall.com/questions/412137/comon%C3%a3o-repeat-c%C3%b3digo-css/412151#412151
– hugocsl
@hugocsl thanks but now confused me a little again kkk. For example, even Header, now in the footer, imagine that inside the footer_Burguer I have an image, as I would name the <img> and I can not use 4 underscores as it is in the BEM pattern, ie footer___burguer_img
– Lucas de Carvalho
I know the question is of the technical part, but there is a question, they invented the GOOD to help "correct" problems that should not even exist and it seems to me that people adopt things like this (not only WELL and not only in CSS) as if it were the one truth that will save you from all your troubles. I’ve used CSS for years, tried to practice and understand very well the selectors and rules (Rules) and organized myself well (really well, not WELL) and never had problems, even received praise for my minimalist CSS that presented the same result and often much lighter...
– Guilherme Nascimento
... The GOOD by itself is to write a lot of things, even more than normal in a supposedly organized way, and in the end you will have much more things than expected and maybe even get lost in the supposed organization. I will summarize, learn the Rules and practice seems to me much more advantageous, most claim to know CSS, but only know the minimum of the basics and so end up believing in alleged solutions and "cake recipes"... It is not a criticism of you, it is a criticism of "the standards" (in various places and languages) which are sometimes problems disguised as "solution"
– Guilherme Nascimento
Thanks for the advice, @Guilhermenascimento!
– Lucas de Carvalho
@Guilhermenascimento is a way to write WELL more than you need to get the result,
– Bacco