Jump to content

[SOLVED] Can you specifiy the height of a BR tag?


Recommended Posts

Not explicitly, it will however assume the line height of the containing DIV, BODY, etc. (I don't think a SPAN will work in this case, so you'll want to use a DIV instead)

 

.linebreak_height {line-height: 0.25;}

See: http://www.w3schools.com/css/pr_dim_line-height.asp

 

Something to that effect should work, though I'm not sure if it'll work in all browsers (check IE 6 and possibly 7).

Actually completely scratch what I just said. I thought you were talking about space-between lines for some reason. You can't determine the height of a line-break because it's breaking a line. A line-break is a line-break.

 

Terribly sorry about that.

There are no 'official' CSS styles for controlling the height of a BR tag, but I think line-height will work as long as the BR is on it's own line.

 

The better way to do it is without BR tags though. Use margin-top/margin-bottom on the element before or after to get the same effect.

It is a very common practice to use br tags for linebreaks.

 

Books are not the same as websites, in books you rarely encounter any linebreaks, and thats fine. However when writing for the web, for readability its recommended to include linebreaks in texts, having walls of text like you would in books is bad.

 

There are two ways to create such linebreaks. Either using two brs, or by closing the paragraph and starting a new. The last option would be to prefer for text, since it creates more "semantic" meaning while using two brs don't, other benefits would include better ability to control the appearance of your text.

Thanks for the info.

I'll use the margin.  That makes sense now that i think about it.  What I really wanted with the particular br was to control spacing.....being that a br is a line break it makes sense to use margin instead.

 

Thanks....

It is a very common practice to use br tags for linebreaks.

 

Very common yes. But that doesn't mean it's correct. There is significantly more crappy design on the net than there is good design. If we went purely by quantity, the crap design would win almost every time.

 

There are two ways to create such linebreaks. Either using two brs, or by closing the paragraph and starting a new. The last option would be to prefer for text, since it creates more "semantic" meaning while using two brs don't, other benefits would include better ability to control the appearance of your text.

 

The bolded line is where the problem comes in. (X)HTML is supposed to be for content, and CSS etc is for markup. Using br tags to control the appearance of your text goes against this separation of content and presentation. If there is a need to adjust content for presentation, it should be done using CSS (or some other markup language), and (X)HTML should be left for content only.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.