Answer the question
In order to leave comments, you need to log in
How not to overdo it with heavy css rules?
Good afternoon!
I have heard many times that technology should be applied where it is needed. Because such solutions as flex and grid are calculated in more complex ways and carry some additional burden on the final product. But sometimes there are situations when it is necessary for a small element, it is faster and easier to apply heavier properties than to rebuild the markup, pile up additional wrappers, or somehow restrict the content.
For example, I came across this situation:
<ul class="usefull-info__list">
<li class="usefull-info__item usefull__item--like">
<a class="usefull-info__link usefull-info__link--bold" href="">Текст</a>
</li>
<li class="usefull-info__item">
<a class="usefull-info__link link-underline" href="">Текст</a>
</li>
</ul>
.usefull-info__list {
display: flex;
flex-direction: column;
margin-right: 10px;
padding-left: 22px;
}
.usefull-info__item:first-child {
margin-top: auto;
}
Answer the question
In order to leave comments, you need to log in
If there are less than 1e6 such rules per page, then no problem, and if there are more, then you are doing something wrong..
This is a normal solution, am I overdoing it? In some cases, I'm really afraid to use the same flexes, because I think it's redundant.
.usefull-info__list {
display: flex;
flex-direction: column;
justify-content: flex-end;
}
.usefull-info__item:first-child {
margin-top: auto;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question