limitphp Posted November 13, 2008 Share Posted November 13, 2008 Is there anyway to control the height of a BR tag? Quote Link to comment https://forums.phpfreaks.com/topic/132589-solved-can-you-specifiy-the-height-of-a-br-tag/ Share on other sites More sharing options...
Goldeneye Posted November 13, 2008 Share Posted November 13, 2008 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). Quote Link to comment https://forums.phpfreaks.com/topic/132589-solved-can-you-specifiy-the-height-of-a-br-tag/#findComment-689772 Share on other sites More sharing options...
Goldeneye Posted November 13, 2008 Share Posted November 13, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/132589-solved-can-you-specifiy-the-height-of-a-br-tag/#findComment-689789 Share on other sites More sharing options...
rhodesa Posted November 13, 2008 Share Posted November 13, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/132589-solved-can-you-specifiy-the-height-of-a-br-tag/#findComment-689813 Share on other sites More sharing options...
haku Posted November 14, 2008 Share Posted November 14, 2008 Exactly. Line breaks are almost always unnecessary. There are few exceptions. Margins should be used for spacing, and instead of line breaks, text on following lines should be placed in new p tags. Quote Link to comment https://forums.phpfreaks.com/topic/132589-solved-can-you-specifiy-the-height-of-a-br-tag/#findComment-689832 Share on other sites More sharing options...
SuperBlue Posted November 14, 2008 Share Posted November 14, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/132589-solved-can-you-specifiy-the-height-of-a-br-tag/#findComment-690040 Share on other sites More sharing options...
limitphp Posted November 14, 2008 Author Share Posted November 14, 2008 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.... Quote Link to comment https://forums.phpfreaks.com/topic/132589-solved-can-you-specifiy-the-height-of-a-br-tag/#findComment-690258 Share on other sites More sharing options...
haku Posted November 15, 2008 Share Posted November 15, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/132589-solved-can-you-specifiy-the-height-of-a-br-tag/#findComment-690573 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.