S
S
svr52018-04-18 11:49:53
css
svr5, 2018-04-18 11:49:53

How to do BEM correctly?

Good afternoon! The question is this:
I have a project, 10 pages, I'm typing in BEM! There are 5 types of text and 4 types of links on the project. I wanted to put the text in a block and probably use modifiers to solve different types of text! And the same with links.
The question is, is it possible to do this? There are solutions, tell me how to do it right
1: Make the block separate with text and separate with links and modifiers, decide the size, color, etc.
2: Do not make a text block, but on each page make elements with text from the page (it turns out code repetition in many places)
PS if the first option is good, then tell me how to properly name the block with text (without using the common name .text?)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alex-85, 2018-04-19
@svr5

Look at the task context. If it makes sense to put this element in a separate block and use it on different pages (with or without modifiers), then make it a block. If it is easier and more reasonable to make an element of a larger block, make it an element.
When deciding how to name the block, again, we start from the context.
In order not to guess yourself, you can look here:
https://github.com/palegrow/css-naming
https://github.com/yoksel/common-words

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question