Controlling the size of a break

I would like to control the size of a break <br>

I don’t want to do this universally, just on an as need basis. Because a double break <br><br> is too much space.

I used this:

<style>
    br {
  content: "";
  margin: 2em;
  display: block;
  font-size: 24%;
}
</style>

…but that would apply to all.

I tried this which doesn’t seem to work:

<div style="line-height: 1.38;">

Does anybody have any good suggestions? Thanks for your help.

You can’t style a break or give it a size, as it’s not a thing that occupies any space.

Line height should work, though it will be the same across all lines in the element you apply it to.

But really I want to ask “why?”
It’s one of those questions that gives me the feeling that if you are asking it, you are doing something wrong.
So I want to know what the intention is, in context with the content.

1 Like

I have used br or a double br to space after a graphic and would like it to be 1.5 or whatever what I think looks the best. So it’s a visual thing and I don’t want to redo the entire page, just resize the spacing. It’s older code and I was wanting a simple fix.

Then you should apply CSS to the graphic or the text that follows the graphic.
Margins create space between elements.
The <br> element is not for making space, it has just one purpose: to force text to break onto a new line.

1 Like

I do understand what you are saying. But the break to the new line has a defined space. Is there not a way, other than what you already mentioned, to define the height of the <br> ?

As Sam said breaks are a semantic html element that create a new line such as would be used in a poem or address. Paragraphs of text would use the p element and no breaks are required.

The break element is not a means of creating space and should not be used for that purpose.

Margins or padding will create space as required and is the method you should use and can in 99% of cases be used without adding extra elements. If you are adding an empty div just to make space then that is wrong also.

You will rarely need to use a break in a well constructed site and it will never be used just to make space. That’s not its purpose although many people do not realise this.

We are not being awkward in saying this but there really is no need to use breaks to make space. It may be that your html is not structured in the best way if you can only achieve your look by using a break.

If you want to post a sample of the html we could offer suggestions on a semantic structure for it. :slight_smile:

3 Likes

Appreciate your thoughts and your willingness to help. Let me see what I do.

Thanks

1 Like