473,425 Members | 1,739 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,425 software developers and data experts.

headers and <br>s

Earlier, there was a discussion of why not to use <br>s too much. I
mostly don't like using <br>s at all but there is one situation where
its seems better than the alternative.

<h4> this is the paragraph header</h4>
<p> this is the paragraph</p>

If I want no margin between the header and the paragraph, I can use:
<h4 class='no_bottom_margin'> this is the paragraph header</h4>
<p class='no_top_margin'> this is the paragraph</p>

But this is sometimes more obnoxious than

<p>
<span class='paragraphheader'>this is the paragraph header</span>
<br>
this is the paragraph</p>

How would you do this ?
Nov 11 '05 #1
13 1777
meltedown wrote:

<h4> this is the paragraph header</h4>
<p> this is the paragraph</p>

If I want no margin between the header and the paragraph, I can use:
<h4 class='no_bottom_margin'> this is the paragraph header</h4>
<p class='no_top_margin'> this is the paragraph</p>

But this is sometimes more obnoxious than
"Obnoxious?" Why?
<p>
<span class='paragraphheader'>this is the paragraph header</span>
<br>
this is the paragraph</p>

This removes useful markup from your content. The header becomes just a
modified form of body text and less for non-visual browsers to process.
And changing header styles does not affect that text style increasing your
maintenance burden.
Do you use the gapless presentation randomly? Or does it tend to clump
together?
Hey! You could use a division and cascade the h4 and p elements so no
explicit class attribute is required.

--
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
Nov 11 '05 #2
Once upon a time *meltedown* wrote:
Earlier, there was a discussion of why not to use <br>s too much. I
mostly don't like using <br>s at all but there is one situation where
its seems better than the alternative.

<h4> this is the paragraph header</h4>
<p> this is the paragraph</p>

If I want no margin between the header and the paragraph, I can use:
<h4 class='no_bottom_margin'> this is the paragraph header</h4>
<p class='no_top_margin'> this is the paragraph</p>

But this is sometimes more obnoxious than

<p>
<span class='paragraphheader'>this is the paragraph header</span>
<br>
this is the paragraph</p>

How would you do this ?


If that header and paragraph is an exeption, different from other
paragraps and <h4> headers on the site, then I use just <h4
style="blablabla"> and <p style="blabla">

But I always try to give all header tags their own style, in the
stylesheet file, e.g. h1 {margin-bottom:12px;} and so on. Less margin
for smaller (sub)headers and use them the same way all over the site.

For the paragraph tag, I mostly set top-margin to "0px" and only use a
bottom-margin to make a space before the next paragraph. That way I
can have a header and a following paragraph with the margins I like.

--
/Arne
-- *Joke of the day* ----------------------------------------
Tech Support: What anti-virus program do you use?
Customer: Netscape.
Tech Support: That's not an anti-virus program.
Customer: Oh, sorry...Internet Explorer.
-------------------------------------------------------------
Nov 11 '05 #3
Jim Moe wrote:
meltedown wrote:

<h4> this is the paragraph header</h4>
<p> this is the paragraph</p>

If I want no margin between the header and the paragraph, I can use:
<h4 class='no_bottom_margin'> this is the paragraph header</h4>
<p class='no_top_margin'> this is the paragraph</p>

But this is sometimes more obnoxious than
"Obnoxious?" Why?


Just that adding all those classes to the tags is a chore. I'll do it
rather than using <br>'s (it seems like I'm giving up control of my text
when anything is not in a block element). I just thought there might be
a shortcut I hadn't thought of.

<p>
<span class='paragraphheader'>this is the paragraph header</span>
<br>
this is the paragraph</p>

This removes useful markup from your content. The header becomes just
a modified form of body text and less for non-visual browsers to
process. And changing header styles does not affect that text style
increasing your maintenance burden.
Do you use the gapless presentation randomly? Or does it tend to clump
together?
Hey! You could use a division and cascade the h4 and p elements so no
explicit class attribute is required.


I guess that could work if all the paragraphs were that way, but there
are always more paragraphs below the one next to the header. All the
header are the same so it would at least cut down on the need to cite
header classes.
Nov 11 '05 #4
Arne wrote:
Once upon a time *meltedown* wrote:

Earlier, there was a discussion of why not to use <br>s too much. I
mostly don't like using <br>s at all but there is one situation where
its seems better than the alternative.

<h4> this is the paragraph header</h4>
<p> this is the paragraph</p>

If I want no margin between the header and the paragraph, I can use:
<h4 class='no_bottom_margin'> this is the paragraph header</h4>
<p class='no_top_margin'> this is the paragraph</p>

But this is sometimes more obnoxious than

<p>
<span class='paragraphheader'>this is the paragraph header</span>
<br>
this is the paragraph</p>

How would you do this ?

If that header and paragraph is an exeption, different from other
paragraps and <h4> headers on the site, then I use just <h4
style="blablabla"> and <p style="blabla">

But I always try to give all header tags their own style, in the
stylesheet file, e.g. h1 {margin-bottom:12px;} and so on. Less margin
for smaller (sub)headers and use them the same way all over the site.

For the paragraph tag, I mostly set top-margin to "0px" and only use a
bottom-margin to make a space before the next paragraph. That way I
can have a header and a following paragraph with the margins I like.

That's a good tip, that might be the shortcut I'm looking for. Thanks.
Nov 11 '05 #5
meltedown wrote:
Jim Moe wrote:
meltedown wrote:
<h4 class='no_bottom_margin'> this is the paragraph header</h4>
<p class='no_top_margin'> this is the paragraph</p>


there
are always more paragraphs below the one next to the header.


Class selectors aren't required. I think someone else already suggested
this:

h4 {margin-bottom: 0;}
p {margin-top: 0; margin-bottom: 1em;}

I do this all the time, on ol/ul as well as paragraphs. Works very nicely.

--
Reply email address is a bottomless spam bucket.
Please reply to the group so everyone can share.
Nov 23 '05 #6
kchayka wrote:
meltedown wrote:
Jim Moe wrote:
meltedown wrote:
<h4 class='no_bottom_margin'> this is the paragraph header</h4>
<p class='no_top_margin'> this is the paragraph</p>


there
are always more paragraphs below the one next to the header.

Class selectors aren't required. I think someone else already suggested
this:

h4 {margin-bottom: 0;}
p {margin-top: 0; margin-bottom: 1em;}

I do this all the time, on ol/ul as well as paragraphs. Works very nicely.

OK thanks, I think I got the hang of it. I used to know this too.
Nov 23 '05 #7
meltedown wrote:
Do you use the gapless presentation randomly? Or does it tend to
clump together?
Hey! You could use a division and cascade the h4 and p elements so
no explicit class attribute is required.


I guess that could work if all the paragraphs were that way, but there
are always more paragraphs below the one next to the header. All the
header are the same so it would at least cut down on the need to cite
header classes.

Sometimes you want space, sometimes you don't. I was curious how the
space/no-space decision occurs: for a whole page? a small section of a
page? Alternate sections? Randomly picked by source code? (Okay, the last
one is unlikely. :-))

--
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
Nov 23 '05 #8
Jim Moe wrote:
meltedown wrote:
Do you use the gapless presentation randomly? Or does it tend to
clump together?
Hey! You could use a division and cascade the h4 and p elements so
no explicit class attribute is required.

I guess that could work if all the paragraphs were that way, but there
are always more paragraphs below the one next to the header. All the
header are the same so it would at least cut down on the need to cite
header classes.

>

Sometimes you want space, sometimes you don't. I was curious how the
space/no-space decision occurs: for a whole page? a small section of a
page? Alternate sections? Randomly picked by source code? (Okay, the
last one is unlikely. :-))

I want a space between everything but a header and a paragraph.
The stuff kchayka and Arne suggested is fine.
h4 {margin-bottom: 0;}
p {margin-top: 0; margin-bottom: 1em;}

Nov 23 '05 #9
On Sat, 12 Nov 2005, meltedown wrote:
I want a space between everything but a header and a paragraph.
The stuff kchayka and Arne suggested is fine.
h4 {margin-bottom: 0;}
p {margin-top: 0; margin-bottom: 1em;}


Have you seen
http://www.complexspiral.com/publica...psing-margins/ ?

Might help in understanding the available options.

Nov 23 '05 #10
Alan J. Flavell wrote:
On Sat, 12 Nov 2005, meltedown wrote:

I want a space between everything but a header and a paragraph.
The stuff kchayka and Arne suggested is fine.
h4 {margin-bottom: 0;}
p {margin-top: 0; margin-bottom: 1em;}

Have you seen
http://www.complexspiral.com/publica...psing-margins/ ?

Might help in understanding the available options.

No I had't seen it. I always wondered why the headers didn't have top
margins in a div. It has tasted my patience more than once. Thanks.
Nov 23 '05 #11
meltedown wrote:
Alan J. Flavell wrote:
On Sat, 12 Nov 2005, meltedown wrote:

I want a space between everything but a header and a paragraph.
The stuff kchayka and Arne suggested is fine.
h4 {margin-bottom: 0;}
p {margin-top: 0; margin-bottom: 1em;}


Have you seen
http://www.complexspiral.com/publica...psing-margins/ ?

Might help in understanding the available options.

No I had't seen it. I always wondered why the headers didn't have top
margins in a div. It has tasted my patience more than once. Thanks.

Actually, what that site says is complicated by the fact that the header
margins in firefox do not collapse like the header margins in figure 2.
Here for example, is a simple header in a div, with no styles
http://reenie.org/test/test13.htm

Nov 23 '05 #12
meltedown wrote:
Alan J. Flavell wrote:

http://www.complexspiral.com/publica...psing-margins/ ?


Actually, what that site says is complicated by the fact that the header
margins in firefox do not collapse like the header margins in figure 2.

http://reenie.org/test/test13.htm


Results can be unpredictable when you trigger quirks mode:
<URL:http://hsivonen.iki.fi/doctype/>

--
Reply email address is a bottomless spam bucket.
Please reply to the group so everyone can share.
Nov 23 '05 #13
kchayka wrote:
meltedown wrote:
Alan J. Flavell wrote:

http://www.complexspiral.com/publica...psing-margins/ ?


Actually, what that site says is complicated by the fact that the header
margins in firefox do not collapse like the header margins in figure 2.

http://reenie.org/test/test13.htm

Results can be unpredictable when you trigger quirks mode:
<URL:http://hsivonen.iki.fi/doctype/>

I added a strict doctype and the header margin still does not collapse
in firefox. http://reenie.org/test/test13.htm
Nov 23 '05 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: fis | last post by:
Hi all, I've problem because there are needed break lines in my texts on the web site but i can't do it :( My pipeline looks like: XMS -> I18N -> XSLT -> HTML I have lot of texts in my...
6
by: Lasse | last post by:
I have done this simple function, it seems to work as intended, to solve a problem i have had for a while. I couldnt find any sample around that was working for me. I would like to test it with...
7
by: noor.rahman | last post by:
I have an XML file that stores data from an HTML form. I use XSL to display the data in HTML format. The data may have newline characters. However, XSL is not displaying the newlines properly in...
7
by: Rocky Moore | last post by:
I have a web site called HintsAndTips.com. On this site people post tips using a very simply webform with a multi line TextBox for inputing the tip text. This text is encode to HTML so that no...
2
by: Winshent | last post by:
I have a multi line text in an admin page on my cms. I am trying to capture carriage returns as and replace them with <p></p> bfore the string gets written to the database. I have tried all...
1
by: Winshent | last post by:
I have a multi line text in an admin page on my cms. I am trying to capture carriage returns as and replace them with <p></p> bfore the string gets written to the database. I have tried all...
9
by: Wayne | last post by:
$a = $_POST; # txt_content = This is a<CR><LF>Test $p = str_replace ("%0D%0A", "<br>", $a); That is the above code that I am using, however, it is not picking up the CR/LF from the textarea. I...
2
by: xhe | last post by:
I met a very headache problem in javascript, I think this might be difference between IE and NS / Safari. I have a text area <form> <textarea name='tex1' onkeyup='displayit();'></textarea>...
7
by: Nathan Sokalski | last post by:
Something that I recently noticed in IE6 (I don't know whether it is true for other browsers or versions of IE) is that it renders <br/and <br></br> differently. With the <br/version, which is what...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.