Reply LinkBack Thread Tools Search this Thread
Old 26-05-2009, 03:38   #1 (permalink)
octavia
Registered User
 
Join Date: May 2008
Posts: 40
Which one is more compatible in this context: <br>, <br/> or <br />

I can't find a simple explanation for this question. I'm trying to write a code as compatible as possible. In the body of a website, inside this tag:
HTML Code:
<div class="txt-content">
Each paragraph uses as paragraph tag, but I want to add an additional space between certain paragraph. But I'm not sure which one of the line breaks is more compatible.

The code would be in HTML.

Thanks.
  Reply With Quote
Old 26-05-2009, 04:07   #2 (permalink)
Rotuy
Limey
 
Rotuy's Avatar
 
Join Date: Apr 2008
Location: Liverpool
Posts: 4,747
just adjust the paragraph tag so it has the extra space. Within your CSS add this:

Code:
p {margin: 0 0 20px 0}

when of course the 20px you adjust according to the space you want. But to answer your question about the br tag, the best way is <br />.
__________________
  Reply With Quote
Old 26-05-2009, 04:09   #3 (permalink)
jenthomson
upcloseandpixelated
 
jenthomson's Avatar
 
Join Date: Dec 2008
Location: Glasgow.
Posts: 73
Send a message via MSN to jenthomson Send a message via Yahoo to jenthomson Send a message via Skype™ to jenthomson
Whats your Doctype set as?

<br /> is XHTML
<br> is HTML
  Reply With Quote
Old 26-05-2009, 04:10   #4 (permalink)
Arties
Graphic Motion Webdesign
 
Arties's Avatar
 
Join Date: Sep 2007
Location: Belgium
Posts: 269
I always use <br>
works for me...

Dreamweaver uses <br> it its help explanation but added <br /> to my code...
Its one of those tags that doesn't need to be closed. I guess that <br /> looks nicer to point that out in your code.
  Reply With Quote
Old 26-05-2009, 04:11   #5 (permalink)
Arties
Graphic Motion Webdesign
 
Arties's Avatar
 
Join Date: Sep 2007
Location: Belgium
Posts: 269
Quote:
Originally Posted by jenthomson
Whats your Doctype set as?

<br /> is XHTML
<br> is HTML


Hehehe , i was looking for this... I AGREE
  Reply With Quote
Old 26-05-2009, 04:20   #6 (permalink)
hawken
Kirin beer goggles
 
hawken's Avatar
 
Join Date: Nov 2003
Location: Tokyo, Japan
Posts: 4,293
Send a message via MSN to hawken
I'm always using <br clear="all"/> in my code. Really have to get out of that habit
__________________
  Reply With Quote
Old 26-05-2009, 06:32   #7 (permalink)
Shiro
Whitey
 
Shiro's Avatar
 
Join Date: Aug 2007
Location: Yokohama, Japan
Posts: 7,324
Quote:
Originally Posted by Arties
I always use <br>
works for me...

Dreamweaver uses <br> it its help explanation but added <br /> to my code...
Its one of those tags that doesn't need to be closed.

That's not necessarily true - as Rotuy said, it depends on your doctype. Using <br> in an XHTML document is invalid code, and using <br /> in an HTML document is invalid code. You should use the one that matches your doctype.

And for the op - <br/> doesn't exist. But as Rotuy said, you should just add the space with CSS.
__________________
This space for rent.

After Hours Japan
  Reply With Quote
Old 26-05-2009, 06:47   #8 (permalink)
herkalees
Semantics, yay.
 
Join Date: Nov 2005
Location: Beverly, Massachusetts
Posts: 1,534
A line-break (which ever way you end up writing it) is not the correct element to use to achieve your goal. More space between paragraphs is a change in the visual style of your document, and as a result, should only ever be defined/created in a style sheet (as Rotuy said).
__________________
  Reply With Quote
Old 26-05-2009, 06:48   #9 (permalink)
Synook
What happened?
 
Synook's Avatar
 
Join Date: Jul 2008
Posts: 1,827
<empty/> is valid XML notation.
__________________
Web developer • AspektasBlogTwitter


  Reply With Quote
Old 26-05-2009, 11:07   #10 (permalink)
octavia
Registered User
 
Join Date: May 2008
Posts: 40
Thank you all. I completely forgot about doctypes (i'm still learning)--I'm using XHTML so I guess <br /> it is. Thanks.

Quote:
Originally Posted by herkalees
A line-break (which ever way you end up writing it) is not the correct element to use to achieve your goal. More space between paragraphs is a change in the visual style of your document, and as a result, should only ever be defined/created in a style sheet (as Rotuy said).

I'm curious about that? I mean, why is that?

I'm trying to write a template with content that will be manually added and edited throughout several pages. We won't use content management so we're trying to be as effective as possible (read:fast) given the limitations. It seems to me that using different paragraph styles would not only be more difficult to read (the code I mean) but it would take more time to write.

Am I wrong here?
  Reply With Quote
Old 26-05-2009, 11:40   #11 (permalink)
herkalees
Semantics, yay.
 
Join Date: Nov 2005
Location: Beverly, Massachusetts
Posts: 1,534
HTML is for marking up content; CSS is for changing the visual style of that content. If your aim is more white-space, you do that with CSS.

The proper use for a <br /> would be something like this:

HTML Code:
<address> Jim Jones<br /> jim.jones@gmail.com </address>
__________________
  Reply With Quote
Old 26-05-2009, 11:40   #12 (permalink)
Agricola
Senior Member
 
Agricola's Avatar
 
Join Date: May 2007
Location: England
Posts: 1,010
Quote:
Originally Posted by octavia
I'm curious about that? I mean, why is that?


I thought it was clear enough. USing <BR> or other things like $nbsp etc to pad out or create white space is wrong. yes you can do it, but you should not.

If you want more space between a couple of paragraphs you use CSS to increase the paragraphs margins. If you just want one paragraph to have a bigger gap then give this a class or if only occurance on page an id.

HTML Code:
Your CSS: .biggergap { margin :0 0 0 40px; } your html <div> <p>adfasd</p> <p class="biggergap">lippy ippy </p> <p>dsfosdfodsfo</p> </div>
__________________
War is Gods way of teaching Americans Geography
Wot Speeling Mishtake?
  Reply With Quote
Old 06-06-2009, 14:18   #13 (permalink)
sbertha
Registered User
 
Join Date: Jun 2009
Posts: 2
Quote:
Originally Posted by hawken
I'm always using <br clear="all"/> in my code. Really have to get out of that habit

Ahh so I guess <br class="clear" /> is more suitable?
  Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Contact Us - Web Design Forums - Archive
Web Hosting by Heart Internet, vBulletin © 2000-2009 Jelsoft Enterprises Limited.
Search Engine Optimization by vBSEO 3.0.0 RC8
Web Hosting by Heart Internet