paragraphs vs breaks

J

Jim S

My use of the <br> tag has been criticised in favour of <p></p> paragraph
tags.
Since the latter involves 'before and after' line formatting, it seems to
be taking a sledgehammer to crack a nut.
I'm sure there must be a reason, but I can't see it.
Explain please.
 
H

Harlan Messinger

Jim said:
My use of the <br> tag has been criticised in favour of <p></p> paragraph
tags.
Since the latter involves 'before and after' line formatting, it seems to
be taking a sledgehammer to crack a nut.
I'm sure there must be a reason, but I can't see it.
Explain please.

Paragraphs are paragraphs and should be marked as paragraphs. Things
that aren't paragraphs, shouldn't be.

Why do you think this is a sledgehammer? I'm not sure what you mean by
"before and after line formatting", but if you're referring to the
vertical margin between paragraphs, that's a normal way to arrange
paragraphs. If you'd rather indent the first line of your paragraphs and
not have a margin between them, use CSS to change their layout.
 
J

Jim S

Paragraphs are paragraphs and should be marked as paragraphs. Things
that aren't paragraphs, shouldn't be.

Why do you think this is a sledgehammer? I'm not sure what you mean by
"before and after line formatting", but if you're referring to the
vertical margin between paragraphs, that's a normal way to arrange
paragraphs. If you'd rather indent the first line of your paragraphs and
not have a margin between them, use CSS to change their layout.

What you say is exactly what I mean.
My pages largely consist of photos with some text.
Arranging this is simple if I add a <br> or two.
If I use <p></p> then, unless I tell it not to do so, then I will get a
'margin' between the photo and the text for example. That seems unnecessary
to me. I use enough CSS as it is without adding more to get things NOT to
do things I don't want.
 
J

Jim S

Well, for instance, this:

<body>

<img src="bowl.jpg" alt="bowl">
<br>
<img src="bowel.jpg" alt="bowel">

</body>

...is illegal markup whereas this:

<body>

<p><img src="bowl.jpg" alt="bowl">
<p><img src="bowel.jpg" alt="bowel">

</body>

...isn't. (Under 4.01 strict, of course.) Sure, putting the whole first
section in a <div> can make it legal, but the tendency when using <br>s for
formatting is to mess up.

I avoid <p> whenever possible and have no trouble validating 4.01 strict on
472 pages.
 
H

Harlan Messinger

Jim said:
I avoid <p> whenever possible and have no trouble validating 4.01 strict on
472 pages.

What you *asked* in your original post was why you are being advised to
use p tags. The answer in two parts is that if you don't *have*
paragraphs, then you *shouldn't* use p tags, but if you have paragraph
then you should, because the whole point of HTML markup is to *describe
your document*, while presentation details are addressed by CSS when you
want them to differ from the default styles applied by browsers. If you
don't care, do what you please, but that's the answer to your question.
If you didn't want to know the answer, you shouldn't have asked. If you
don't like the answer, well, it's still the answer.
 
A

Andy Dingley

My use of the <br> tag has been criticised in favour of <p></p> paragraph
tags.
Since the latter involves 'before and after' line formatting, it seems to
be taking a sledgehammer to crack a nut.

Paragraphs are paragraphs, linebreaks are linebreaks. That's how it is
(for a whole edifice of implied other pieces of software involved in
"the web"), so you just don't get to change this. Use it how it ought
to be used, or fight against it - but there's no "option to do it
differently".

<p> _could_ have been defined to mean "paragraph separator", but it
wasn't. A choice. Made now, so live with it.

If you want to understand _why_ all these things are how thhey are, at
the cost of some fairly heavy reading, then dig out Hakon Lie's PhD
thesis on the background to and design of CSS itself. Free download if
you search, and well worth the effort of reading through it all.
 
B

Blinky the Shark

Harlan said:
Paragraphs are paragraphs and should be marked as paragraphs. Things
that aren't paragraphs, shouldn't be.

I think if you look at Jim's...uh..."paragraph", above, you'll see why
he's unsure of the concept. Even without consideration of markup, using
plain text, his use of a newline after every period (full stop; sentence)
shows confusion about the whole concept of the paragraph.
Why do you think this is a sledgehammer? I'm not sure what you mean by
"before and after line formatting", but if you're referring to the
vertical margin between paragraphs, that's a normal way to arrange
paragraphs. If you'd rather indent the first line of your paragraphs and
not have a margin between them, use CSS to change their layout.

See above.
 
J

Jim S

I think if you look at Jim's...uh..."paragraph", above, you'll see why
he's unsure of the concept. Even without consideration of markup, using
plain text, his use of a newline after every period (full stop; sentence)
shows confusion about the whole concept of the paragraph.


See above.

Blinky you are a tit.
No-one writes paragraphs in usenet, because each newsreader displays text
in its own peculiar way.
I came here as usual for help, but it's very scarce.
If my pages would be 'better' for the use of paragraphs then I might use
them, but I was looking for someone to explain why. I can and do use
paragraphs where continuous text is involved, but that is not where the
criticism was directed.
 
H

Harlan Messinger

Jim said:
Blinky you are a tit.
No-one writes paragraphs in usenet, because each newsreader displays text
in its own peculiar way.

No one writes paragraphs in Usenet? What do you think my text beginning
"Why do you think" and ending "change their layout" is? What do you
think Blinky's text beginning "I think if" and ending "of the paragraph"
is? Those are paragraphs.
I came here as usual for help, but it's very scarce.

You came for the answer to a question. You were given the correct
answer, and you chose to take it as a command against which you then
rebelled and created a scene. Is it your intention to be a troll, or are
you unaware that you're acting like one?
If my pages would be 'better' for the use of paragraphs then I might use
them, but I was looking for someone to explain why. I can and do use
paragraphs where continuous text is involved, but that is not where the
criticism was directed.

If they *aren't* paragraphs, then don't use the friggin' p tags! I told
you that twice already. What the hell is your problem?

Maybe you're angry because no one here has explained to you why some
other people have been telling you to use p tags in this particular
instance. How the hell do we know? Ask them!
 
P

Phil Kempster

Harlan said:

What would be an acceptable method of replicating the effect of what Jim
has with now, a <br> after an <img scr=" .... ?
Without using <p> </p> I mean :-}
 
H

Harlan Messinger

Phil said:
What would be an acceptable method of replicating the effect of what Jim
has with now, a <br> after an <img scr=" .... ?
Without using <p> </p> I mean :-}
There isn't anything tremendously wrong with using <br> if the image is
in some realistic way part of the information being conveyed. The
semantically meaningless div tag can be used to make a chunk of code a
block, and browsers by default add no margins to div elements..
 
D

dorayme

Jim S said:
My use of the <br> tag has been criticised in favour of <p></p> paragraph
tags.
Since the latter involves 'before and after' line formatting, it seems to
be taking a sledgehammer to crack a nut.
I'm sure there must be a reason, but I can't see it.
Explain please.

Short answer:

You need to specify the exact case of the criticism. In some
circumstances it would be using a sledgehammer to crack a pea, in others
not.

Longer answer:

From my recollection of your pages, there are many pictures and
thumbnails, captions and explanations of pics... So I will address just
these two cases. One where there is a thumbnail or bigger and a caption.
Two, where there is a pic and some longer explanation or reference to
the picture.

One, it is quite acceptable to use a br if you are using an inline image
to place a few short words underneath the pic. If you do nothing, then
the words will generally appear to the right and wrap only when space
runs out - not what is wanted! You want a line break and that is what br
does. It also has the natural advantage of making the words nice and
close to the bottom of the pic, assuming line-height is not unusual. A
look that is often wanted.

But talking about looks, one advantage of enclosing the text, even in
this particular circumstance in a suitable suitable element is that this
element can often be more easily styled. The style can be changed in a
style sheet to affect the whole site. You can have the text bold, or
italic or small or big. You can also have the top margin smaller than
the usual default (Browsers give p elements, for example, default
margins that satisfy the usual needs of authors. Sometimes the author
wants to use a paragraph without the usual gaps and in CSS this is
easily accomplished).

I am still on "one", the topic of the shortish caption. Above I
mentioned the alternative to a simple br but did not mention a p
specifically because it would be slightly uncomfortable to use a p for
something that is not in the normal way a paragraph (a set of sentences,
followed or preceded by others usually). In practice, it is not so easy
to be so strict and a p would be acceptable imo. But if you wanted to be
a bit stricter, you could use a div or even a span (depending on what
quite you wanted).

None of this stuff is laid down in heaven, you have to make decisions,
how semantically strict you want to be, how such semanticity would be
appreciated or totally wasted on the world and so on... <g>

But the main point remains, you can just use br here for a caption.

You can also style the words in spite of the br and no separate element
for the words. (No, I am not contradicting what I said above) by
attention to your circumstances. For example if your captions are in a
context like:

<div class="thumbbox>
<img src="dummy.gif" alt="some">
<br>
a shortish caption
</div>

You can style

..thumbox img {display: block;}

and this will stop the image being inline. The text will then
automatically go to the next line.

You can also style the text by the handle of the class:

..divbox {font-size: .9em; font-weight: bold; width:
....thumbnail-size...;}

if there is no other text associated with such divs.

Now to the second case where you have a picture and you truly want to
say a few words, it is not a mere caption. Well, a paragraph looks to me
to be the appropriate thing to use here. I better stop, had not meant to
go on so with the above. <g>
 
D

dorayme

dorayme said:
<div class="thumbbox>
<img src="dummy.gif" alt="some">
<br>
a shortish caption
</div>

You can style

.thumbox img {display: block;}

read

..thumbbox img {display: block;}
 
J

Jim S

Short answer:

You need to specify the exact case of the criticism. In some
circumstances it would be using a sledgehammer to crack a pea, in others
not.

Longer answer:

From my recollection of your pages, there are many pictures and
thumbnails, captions and explanations of pics... So I will address just
these two cases. One where there is a thumbnail or bigger and a caption.
Two, where there is a pic and some longer explanation or reference to
the picture.

One, it is quite acceptable to use a br if you are using an inline image
to place a few short words underneath the pic. If you do nothing, then
the words will generally appear to the right and wrap only when space
runs out - not what is wanted! You want a line break and that is what br
does. It also has the natural advantage of making the words nice and
close to the bottom of the pic, assuming line-height is not unusual. A
look that is often wanted.

But talking about looks, one advantage of enclosing the text, even in
this particular circumstance in a suitable suitable element is that this
element can often be more easily styled. The style can be changed in a
style sheet to affect the whole site. You can have the text bold, or
italic or small or big. You can also have the top margin smaller than
the usual default (Browsers give p elements, for example, default
margins that satisfy the usual needs of authors. Sometimes the author
wants to use a paragraph without the usual gaps and in CSS this is
easily accomplished).

I am still on "one", the topic of the shortish caption. Above I
mentioned the alternative to a simple br but did not mention a p
specifically because it would be slightly uncomfortable to use a p for
something that is not in the normal way a paragraph (a set of sentences,
followed or preceded by others usually). In practice, it is not so easy
to be so strict and a p would be acceptable imo. But if you wanted to be
a bit stricter, you could use a div or even a span (depending on what
quite you wanted).

None of this stuff is laid down in heaven, you have to make decisions,
how semantically strict you want to be, how such semanticity would be
appreciated or totally wasted on the world and so on... <g>

But the main point remains, you can just use br here for a caption.

You can also style the words in spite of the br and no separate element
for the words. (No, I am not contradicting what I said above) by
attention to your circumstances. For example if your captions are in a
context like:

<div class="thumbbox>
<img src="dummy.gif" alt="some">
<br>
a shortish caption
</div>

You can style

.thumbox img {display: block;}

and this will stop the image being inline. The text will then
automatically go to the next line.

You can also style the text by the handle of the class:

.divbox {font-size: .9em; font-weight: bold; width:
...thumbnail-size...;}

if there is no other text associated with such divs.

Now to the second case where you have a picture and you truly want to
say a few words, it is not a mere caption. Well, a paragraph looks to me
to be the appropriate thing to use here. I better stop, had not meant to
go on so with the above. <g>

Thanks again friend.
I cannot remember whether it was you or someone else, helping me some time
ago and I cannot find the article in question, but I was in the process of
ensuring that my pages conformed to 4.01 strict. I remember digging my
heels in over my use of tables as placeholders, but whoever it was, said
something to the effect that my repeated use of <br> instead of <p></p> was
against the 'spirit' what I had managed to achieve at that point.
 
R

richard

My use of the <br> tag has been criticised in favour of <p></p> paragraph
tags.
Since the latter involves 'before and after' line formatting, it seems to
be taking a sledgehammer to crack a nut.
I'm sure there must be a reason, but I can't see it.
Explain please.

The way I see it, a paragraph tag formats text in a certain way while
a break merely injects a blank line.
I would just as rather put the text in a division and CSS the division
the way I want to show it. If I want to use two or more br's that's my
damn business. Then we could go back to the old ways and include a
spacer.gif.
For those bitching and whining about the use of a carriage return
after every frickin period, I say, horsehockey!
Yes sir.
Horsehockey!
If ya don't like it, tough.
 
B

Blinky the Shark

richard said:
The way I see it, a paragraph tag formats text in a certain way while
a break merely injects a blank line.
I would just as rather put the text in a division and CSS the division
the way I want to show it. If I want to use two or more br's that's my
damn business. Then we could go back to the old ways and include a
spacer.gif.
For those bitching and whining about the use of a carriage return
after every frickin period, I say, horsehockey!
Yes sir.
Horsehockey!
If ya don't like it, tough.

Hey, it doesn't make *us* look st00pid.
 
R

richard

Hey, it doesn't make *us* look st00pid.

look here cap'n dude, like I am the master at butchering the frickin
queens english ya knows. It takes a lot of hard work resembling that
remark ya frickin frootcake.
An intelligent man can play the part of a fool, but a fool can never
play the role of an intelligent man.
Oh and please do blame it all on my college preparing high school
english teachers ok.
 
R

richard

No one writes paragraphs in Usenet? What do you think my text beginning
"Why do you think" and ending "change their layout" is? What do you
think Blinky's text beginning "I think if" and ending "of the paragraph"
is? Those are paragraphs.


You came for the answer to a question. You were given the correct
answer, and you chose to take it as a command against which you then
rebelled and created a scene. Is it your intention to be a troll, or are
you unaware that you're acting like one?


If they *aren't* paragraphs, then don't use the friggin' p tags! I told
you that twice already. What the hell is your problem?

Maybe you're angry because no one here has explained to you why some
other people have been telling you to use p tags in this particular
instance. How the hell do we know? Ask them!

<p>
Within the context of the English journalistic communication area, a
paragraph is supposed to be a single train of thought. Ergo, if my
train of thought passes on to a second sub-topic, then I create a
second paragraph. Of which, both paragraphs could all be encompassed
within one single <p> tag. As demonstrated by the use of <p></p> tags
within this post.

However, in the practices of html and web site presentation, a
paragraph is actually a formatted area of text. Whether or not that
area of text is actually in line with being the definition of a
paragraph.

Whereas, a break tag would be used to seperate two paragraphs for
easier reading.
</p>
 
C

Chris F.A. Johnson

On 2008-07-23, richard wrote:
....
<p>
Within the context of the English journalistic communication area, a
paragraph is supposed to be a single train of thought. Ergo, if my
train of thought passes on to a second sub-topic, then I create a
second paragraph. Of which, both paragraphs could all be encompassed
within one single <p> tag. As demonstrated by the use of <p></p> tags
within this post.

However, in the practices of html and web site presentation, a
paragraph is actually a formatted area of text. Whether or not that
area of text is actually in line with being the definition of a
paragraph.

Whereas, a break tag would be used to seperate two paragraphs for
easier reading.
</p>

Since <p> is for paragraph, not paragraphs, your usage is
illogical and contrary to semantic markup.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,099
Messages
2,570,626
Members
47,237
Latest member
David123

Latest Threads

Top