D
D
dmitriyivvvv2018-05-06 21:23:48
css
dmitriyivvvv, 2018-05-06 21:23:48

BEM modifiers for text?

An idea came to mind. There are often paragraphs or spans in the code that contain text that does not particularly have a semantic meaning and needs to be changed a little (usually the font size or text color) So, is it possible to make a .text class according to BEM rules (for p and span ) and add a bunch of modifiers like text_size_m, text_size_l, etc. for this class. Then use them on the appropriate node, for example:

<p class="text text_size_l">random useless text</p>

wouldn't that be against BEM rules or is there a better way to do this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Nikolaev, 2018-05-06
@dmitriyivvvv

No, it doesn't contradict BEM rules. You can do it, yes. Another thing is that you can get away from the imperative enumeration of how the element looks like, and give the element a declarative class that describes what it is for. For example, disclaimer or quote .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question