Css style class for line height

Can you do a style class or id for a <br> so it would apply to just the one you want?

 <style>br {
    line-height: 8px;

Firstly, it’s bad idea to use units to define line-height, go unitless.

The line height is whatever the line height is for the piece of text concerned, all <br> does is start a new line in that text.
I’m guessing you are misusing br for what should be a paragraph <p>, so use a paragraph and apply padding/ margin to that.
Unless you can explain the use case for this more clearly and convince you are using the correct html elements.


So, does the br line height work?


Please show the code before and after the break tag… the context in which the break tag resides.

or you could take a basic HTML and CSS class.

No it does not work and would make no difference as it’s the other content in that line that will control the height of the line anyway. The break just creates a new line.

As already said above it seems like you are mis-using the break tag as it is not a replacement for p tags and is never used just to make space.


It’s the div or the paragraph above and below the line break that can be controlled in height. In CSS, you can use “height:," "margin:,” “padding,” and some other commands.

First you need to make the paragraph or div end. Then do your adjustments.

Put your nose to the grindstone.

1 Like

Yep, I once tried to adjust to br tag. The only fix I came up with was too lame to use. Something like white letters on white background, then adjusting the letter height. That is SEO spam, 'cause its a tactic for keyword stuffing.

1 Like

I still use br for breaks and br br for a paragraph break. When I want to adjust it, I stop the div or p, and add margin like this: margin:9px 0 7px. 9px is the top then it goes in a circle ending on the left. When the left and right are the same (0), then the left doesn’t need to be in the code. That goes for the top and bottom, if the left and right are the same. E.g., this is good: margin:0.

Never ever do that. That’s not what breaks are for.:slight_smile:


Is the br then only to be used for text tags?

The HTML <br> element produces a line break in text (carriage-return). It is useful for writing a poem or an address, where the division of lines is significant.

Do not use <br> to increase the gap between lines of text; use the CSS margin property or the <p> element.


You can use br to add quick space between divs, paragraphs and images.

I think not using br br is because there could be an issue with how web bots read your content, right? Too much content in a paragraph may not look good, 'cuase there needs to be paragraph breaks for reader friendliness.

Hint, stop thinking. Read the references that have been posted and learn something new and replace the old… or not.

We are advocating HTML and CSS as it is used on a finished web page. One can always take “short cuts”, such as using <br> tags for extra space during the development process, but one should replace the incorrect shortcuts with proper code before going “live”. Personally, I found that using such “shortcuts” invited poor “engineering” decisions (planning) on the site and necessarily introduced errors that had to be cleaned up later… and I dislike re-work. In the end, doing it right the first time works much better for me.

The W3C recommends using specific HTML tags (elements) because of the meaning that they imply. <p> tags imply paragraphs, etc. One can also alter the spacing between paragraphs in the CSS, if desired, which computes to fewer wasted elements.


You can but you shouldn’t. Please read the references we’ve pointed to and stop advocating bad practices

No it has nothing to do with that. Breaks are not meant just to make space and should never be used for that purpose. Their use is clearly documented in the references we have linked to.

There would never be a case for having two breaks together anyway. Html is all about creating a semantic structure so you should use tags wisely and semantically and not throw any old junk into the mix:)


There may be other legitimate uses, but I can think of only two.


There once was a man from Nantucket<br>
That went to the shore with a bucket<br>


Bill Gates<br>
1 Microsoft Way<br>

I confess I do abuse them in one of my common eccentricities of formatting a paragraph like a list of sentences.
Not recommended.

And I sometimes use them to force word-wrap in what I think would be a more natural break.


I tend to use the more semantically inert span to force wrapping where I want it, with display set to either block, to always wrap, or inline-block to wrap when space is tight, breaking the line where I want it to.

The point in my first reply was that the fact you are asking the question leads me to believe you are misusing the br tag.
Perhaps you can put this in context and explain your usage.


Thanks. I will now minimize all brs. I have tons of them and it will always be one of my things to do when editing a page.


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