HighDots Forums  

<p> or <br>

alt.html alt.html


Discuss <p> or <br> in the alt.html forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Jim Scott
 
Posts: n/a

Default <p> or <br> - 10-09-2006 , 08:01 AM






Is it a debateable point or 'whatever suits' as to whether test is
presented using <p> or <br> tags?

--
Jim
Tyneside UK
http://www.jimscott.co.uk

Reply With Quote
  #2  
Old   
Steve Pugh
 
Posts: n/a

Default Re: <p> or <br> - 10-09-2006 , 08:24 AM






Jim Scott wrote:
Quote:
Is it a debateable point or 'whatever suits' as to whether test is
presented using <p> or <br> tags?
No.

If it's a paragraph then mark it up with a <p> element.

If it's a line break then mark it up with a <br> element.

They mean different things and in most browsers result in a different
presentation.

Steve



Reply With Quote
  #3  
Old   
Andy Dingley
 
Posts: n/a

Default Re: <p> or <br> - 10-09-2006 , 09:03 AM




Jim Scott wrote:

Quote:
Is it a debateable point or 'whatever suits' as to whether test is
presented using <p> or <br> tags?
Neither - it's very clear.

<p>Marks the boundaries of a paragraph. <br> is an inline element that
marks a line break, where it occurs _within_ some piece of text. That's
really all there is to it - it's pretty clearly stated, if only you
follow the HTML spec through in detail.

<br><br> is always wrong. You've broken the line once, how do you break
it a second time?

If you want a debate, then it's less clear-cut when you should use <p>
and <div>. Obviously <p> is used for paragraphs and <div> should be
used for "chunks fo text that aren't a grammatical paragraph", but this
is a viable grammar question about similar HTML constructs when <p> vs.
<br> is really comparing chalk and cheese.



Reply With Quote
  #4  
Old   
Jim Scott
 
Posts: n/a

Default Re: <p> or <br> - 10-09-2006 , 10:19 AM



"Andy Dingley" <dingbat (AT) codesmiths (DOT) com> wrote in news:1160399014.713784.222520
@c28g2000cwb.googlegroups.com:

Quote:
Jim Scott wrote:

Is it a debateable point or 'whatever suits' as to whether test is
presented using <p> or <br> tags?

Neither - it's very clear.

p>Marks the boundaries of a paragraph. <br> is an inline element that
marks a line break, where it occurs _within_ some piece of text. That's
really all there is to it - it's pretty clearly stated, if only you
follow the HTML spec through in detail.

br><br> is always wrong. You've broken the line once, how do you break
it a second time?

If you want a debate, then it's less clear-cut when you should use <p
and <div>. Obviously <p> is used for paragraphs and <div> should be
used for "chunks fo text that aren't a grammatical paragraph", but this
is a viable grammar question about similar HTML constructs when <p> vs.
br> is really comparing chalk and cheese.

Not quite.
On my site, which is almost all pictures with text, using <br> avoids a space
appearing between the text and the picture or is that because I use </p>?
--
Jim
Tyneside UK
http://www.jimscott.co.uk


Reply With Quote
  #5  
Old   
Steve Pugh
 
Posts: n/a

Default Re: <p> or <br> - 10-09-2006 , 10:30 AM



Jim Scott wrote:

Quote:
On my site, which is almost all pictures with text, using <br> avoids a space
appearing between the text and the picture or is that because I use </p>?
Most browsers give top and bottom margins to paragraphs. So <p>...</p>
will have some white space before and after it.

You can suggest that the margins be zero size via CSS, so if it is
logically a paragraph but you don't want the white space, use
<p>...</p> and set the margins to zero in CSS. But if it is not
logically a paragraph don't use <p>...</p>.

Steve



Reply With Quote
  #6  
Old   
Andy Dingley
 
Posts: n/a

Default Re: <p> or <br> - 10-09-2006 , 11:12 AM




Jim Scott wrote:

Quote:
On my site, which is almost all pictures with text, using <br> avoids a space
appearing between the text and the picture or is that because I use </p>?
What's a "space" ? Sounds like a presentation issue, in which case
don't worry about it in the HTML, leave it to the CSS.

If you <img> is part of the same para as the text, then use <br>
between them.

If your test is a separate paragraph beneath the image (or above, or
alongside it) then use <p>...</p> and put the <img> elsewhere.



Reply With Quote
  #7  
Old   
jojo
 
Posts: n/a

Default Re: <p> or <br> - 10-09-2006 , 11:59 AM



Andy Dingley wrote:
Quote:
On my site, which is almost all pictures with text, using <br> avoids a space
appearing between the text and the picture or is that because I use </p>?

What's a "space" ? Sounds like a presentation issue, in which case
don't worry about it in the HTML, leave it to the CSS.

If you <img> is part of the same para as the text, then use <br
between them.

If your test is a separate paragraph beneath the image (or above, or
alongside it) then use <p>...</p> and put the <img> elsewhere.

And if you have got a image with some subtitle or description use a
<div> (because it'S no "grammatical paragraph" as andy already said).


Reply With Quote
  #8  
Old   
rvtol_pe@hotmail.com
 
Posts: n/a

Default Re: <p> or <br> - 10-09-2006 , 12:26 PM




Quote:
br><br> is always wrong. You've broken the line once, how do you break
it a second time?
I don't see why this is wrong. BR is a single line break and there is
nobody forbidding you to use 2 of them and it will validate correctly.
The P tag simply helps you to define a paragraph and to have some more
flexibility when it comes to styling; however, there are plenty of
cases that would have a double BR making your code more readable.



Reply With Quote
  #9  
Old   
John Salerno
 
Posts: n/a

Default Re: <p> or <br> - 10-09-2006 , 01:46 PM



rvtol_pe (AT) hotmail (DOT) com wrote:
Quote:
br><br> is always wrong. You've broken the line once, how do you break
it a second time?

I don't see why this is wrong.
Probably because most people do <br><br> when they want to create space
on the page, and that's a stylistic thing.

Quote:
there are plenty of
cases that would have a double BR making your code more readable.
Do you mean more readable in a text editor? If so, why would you use an
HTML tag for this?


Reply With Quote
  #10  
Old   
John Salerno
 
Posts: n/a

Default Re: <p> or <br> - 10-09-2006 , 01:48 PM



Andy Dingley wrote:

Quote:
Obviously <p> is used for paragraphs and <div> should be
used for "chunks fo text that aren't a grammatical paragraph"
Just out of curiosity, where did you get that quote from? I can see why
it would be confusing if <div> is still defined in terms of "text" and
"paragraph", but it seems (to me, at least) that <div> is really used
for sections of your webpage that are distinct in terms of overall
content, i.e. a header and a footer can each be a <div>, the main body
could be, sidebars could be, etc. In those terms, it has nothing to do
with text or paragraphs necessarily.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.