Answer the question
In order to leave comments, you need to log in
How not to overlap with class names in bootstrap?
I trained to make up myself, made a couple of layouts and decided that it was time to get acquainted with the bootstrap.
My problem is that I begin to understand something better when I use it than through tutorials, books. Although with this method of self-learning, at first you have to endure pain and self-humiliation from the fact that nothing works out.
I chose an interesting layout for myself and I want to try my styles + using bootstrap. There just is what is more convenient to do with bootstrap and what is more convenient to do with handles.
How should you name your classes so you don't accidentally use a class used by bootstrap?
My options:
prefix my. "My class"
Use underscore. I looked at the code with my eyes, Bootstrap does not have underscore classes. "_class"
Sorry for such a stupid question on such a serious resource. I'm learning.
Answer the question
In order to leave comments, you need to log in
Try to develop your own framework, start with your own documentation, form an intuitive system of prefixes in advance, you can use one letter, for example:
l - layout
m - module
f - form
i - item
n - navigation
and so on.
It is desirable to write the prefix with a hyphen, the class with an underscore, the dependent child class - with a double underscore modifier - with a hyphen.
Thus, the classes are very capacious and unique, for example, the menu will look like:
<ul class="n-m">
<li class="n-m__i">
<a class="n-m__i_a n-m__i_a-a">
button 1
</a>
</li>
<li class="n-m__i">
<a class="n-m__i_a">
button 2
</a>
</li>
</ul>
Use namespace. This is a fairly common practice for isolating styles.
well, if you start to learn then read https://ru.bem.info/ and immediately start naming the classes like that. then you definitely won’t intersect with bootstrap in terms of classes
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question