<br> or not <br>, that is the question

Hi all!
I read that using br for adding space between p or other block elements is evil, not good style. But it is so handy and this tag exists for that. Otherwise you have to define css-classes with margin etc. and later on you do not know what the class was for.
What do you pros think about it?
Thank you!

Using br tags for layout is completely unmanageable and a bad practice. It is only because you haven’t used it with anything complex or with multiple developers.

Using CSS margins gives you fine-grained control and you know exactly why and where the space is coming from when inspecting the styles.

You also can’t do neat things like this with the br tag

* + * {
  margin-top: 1.5em;

Nor can you put the margin values into variables for reuse.

The spacing used in the layout should be deterministic and follow some rules about the white-space “rhythm” of the layout. You can also create utility classes for margins and incorporate that into a style/design system.

Do not use br tags for layout. They are meant for breaking up text, not creating space between elements.

Whow, this is a comprehensive article, thank you! Will take me some time to digest it, but highly informative. :smiley:

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.