Open glaszczyk opened 8 years ago
Your example above is correct. Only, I would use the no -wrapper, main-window__gallery is enough.
Thank you. I used wrapper only to make my idea clearer. But good to know that is not best idea for name. I have to spend more time on naming convention.
I understand how mixes work but I think my example doesn't fit that solution.
Your example perfectly fit.
Can you please explain that?
Let's say, when I would like to position my .gallery
and .story
using flexbox mixes probably don't work. But maybe I missed something.
Thanks
@glaszczyk with mixes your markup will look like this:
<div class="main-window">
<div class="gallery main-window__gallery">
<!-- Here is gallery content -->
</div>
<div class="story main-window__story">
<!-- Here is story content -->
</div>
</div>
So you may apply all the needed styles (flexbox or whatever) to elements of main-window
and keep gallery
and story
reusable just the same way as in your example above but without extra DOM nodes.
Thanks a lot. Now I see what do you mean and where both approaches differ. So both are correct but can be used little different.
Hello!
I'm newbie in BEM and trying to use it in my workflow but I'm not sure how solve that problem.
I would like to create simple layout and position all elements i.e. something like this:
Should I style
.gallery
and.story
with position and dimension properties or maybe should I nest them in.main-window
elements. Something like that:Now I can separate
.gallery
and.story
styling from their position because I can define size and position with.main-window
elementsSorry for (probably) such a simple question but I didn't find answer for that.
Thanks.