Jump to content

<br> or <br />?

Which is older and which is newer/better? Which should I (you) use?

  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • This topic is locked

<br> or <br />? Which is older and which is newer/better? Which should I (you) use? Rate Topic: -----

#1 User is offline   temhawk 

  • W.R. Private First-Class
  • Group: Members
  • Posts: 322
  • Joined: 30-August 07
  • Gender:Male
  • Interests:travel, cg art, macs, music, skateboarding, programming, discovery channel, TextMate 2

Posted 14 October 2007 - 09:05 AM

I've seen so many source codes (excluding my own) with <br> and many with <br />.

1. Does it make a difference?
2. Which is older/dirty and which is newer/clean, thus better to use?

:excl: I honestly have to say that <br /> looks a bit unnecessary; why an extra white-space and a slash? Browsers can interpret <br> just as fine, can't they? So is it okay if I keep on using <br>?
0

#2 User is offline   marcamos 

  • W.R. General
  • Group: Administrators
  • Posts: 2,849
  • Joined: 04-April 06
  • Gender:Male
  • Location:Massachusetts - USA

Posted 14 October 2007 - 09:11 AM

<br> = old and unsupported
<br /> = current and correct.

It's because when you use proper XHTML, every element needs to be 'closed', and by inserting that forward-slash, the br element officially closes itself.
0

#3 User is offline   benbacardi 

  • Administrator
  • Group: Administrators
  • Posts: 1,140
  • Joined: 06-April 06
  • Gender:Male
  • Location:United Kingdom

Posted 14 October 2007 - 09:15 AM

What he said.
0

#4 User is offline   temhawk 

  • W.R. Private First-Class
  • Group: Members
  • Posts: 322
  • Joined: 30-August 07
  • Gender:Male
  • Interests:travel, cg art, macs, music, skateboarding, programming, discovery channel, TextMate 2

Posted 14 October 2007 - 10:27 AM

First, thank you for that tiny bit of valuable info.


Second, I'm still against <br />. I'll switch over though. But I think it's unnecessary... tags like this shouldn't have to be closed, because they're not part of an element! It's like making everything to require a closing, because programers can't remember which tags to close and which not! It's unnecessary, in the true sense of the word!

But o' well. I know I'm stubborn.
0

#5 User is offline   sypher 

  • the owner3r
  • Group: Administrators
  • Posts: 1,578
  • Joined: 04-April 06
  • Location:North Wales, UK
  • Interests:Art, Boxing, MMA, Graphic Design, Web Design etc. ;)

Posted 14 October 2007 - 10:44 AM

Its not exactly more work :P

meta img input all need self closing too.
sypher design - North Wales Web Design | Latest Work: - Scala Cinema

CSS - Can't See Sh*t
0

#6 User is offline   Man2u2uk 

  • W.R. Lieutenant
  • Group: Members
  • Posts: 396
  • Joined: 14-April 07
  • Gender:Male

Posted 14 October 2007 - 10:57 AM

When converting my website to XHTML, as soon as i out the XHTML doctype in and then ran the cleanup tool in dreamweaver it converted nearly all my tags to have /> :)

the went though and finished it off manually
0

#7 User is offline   pgo 

  • W.R. Corporal
  • Group: Members
  • Posts: 83
  • Joined: 07-September 07
  • Gender:Male
  • Location:Oklahoma, USA

Posted 14 October 2007 - 11:19 AM

View Posttemhawk, on Oct 14 2007, 10:27 AM, said:

It's like making everything to require a closing


That's because in XHTML, every tag must be closed.

View Posttemhawk, on Oct 14 2007, 10:27 AM, said:

because programers can't remember which tags to close and which not! It's unnecessary, in the true sense of the word!


First, XHTML is not programming - it's markup. CSS is not programming, either. JavaScript, PHP, ASP, Ruby: those are programming languages.

Second, close every tag or it's not XHTML.

From w3schools:

Quote

XML is a markup language where everything has to be marked up correctly, which results in "well-formed" documents.

XML was designed to describe data and HTML was designed to display data.

Today's market consists of different browser technologies, some browsers run Internet on computers, and some browsers run Internet on mobile phones and hand helds. The last-mentioned do not have the resources or power to interpret a "bad" markup language.

Therefore - by combining HTML and XML, and their strengths, we got a markup language that is useful now and in the future - XHTML.

XHTML pages can be read by all XML enabled devices AND while waiting for the rest of the world to upgrade to XML supported browsers, XHTML gives you the opportunity to write "well-formed" documents now, that work in all browsers and that are backward browser compatible !!!

0

#8 User is offline   temhawk 

  • W.R. Private First-Class
  • Group: Members
  • Posts: 322
  • Joined: 30-August 07
  • Gender:Male
  • Interests:travel, cg art, macs, music, skateboarding, programming, discovery channel, TextMate 2

Posted 14 October 2007 - 12:26 PM

Okay, okay!

Accepted!

You've made yourselves clear, and thus I'm going to clean up my (X)HTML :P
0

#9 User is offline   supasnail 

  • W.R. Corporal
  • Group: Members
  • Posts: 112
  • Joined: 19-September 07

Posted 08 November 2007 - 05:58 AM

View Posttemhawk, on Oct 14 2007, 06:26 PM, said:

Okay, okay!

Accepted!

You've made yourselves clear, and thus I'm going to clean up my (X)HTML :P


<br> is not old nor unsupported, it is valid and correct HTML 4.01 mark-up.
<br /> is valid xHTML * mark-up, but invalid HTML 4.01 mark-up.

The tag you use depends on the doctype of the page you are constructing. The doctype you choose will be dependent on the nature, content and function of the page you are creating. No doctype is 'better' than any other, but simply more appropriate.

This post has been edited by supasnail: 08 November 2007 - 05:59 AM

0

#10 User is offline   marcamos 

  • W.R. General
  • Group: Administrators
  • Posts: 2,849
  • Joined: 04-April 06
  • Gender:Male
  • Location:Massachusetts - USA

Posted 08 November 2007 - 06:02 AM

Very true... thank you for adding that :borat:

I seem to be so wrapped up in XHTML, I nearly forgot that HTML is still used out there.
0

#11 User is offline   temhawk 

  • W.R. Private First-Class
  • Group: Members
  • Posts: 322
  • Joined: 30-August 07
  • Gender:Male
  • Interests:travel, cg art, macs, music, skateboarding, programming, discovery channel, TextMate 2

Posted 08 November 2007 - 06:35 AM

Heh. Okay. That sounds good.

I'm an xhtml-er already. n00b of course :P
0

#12 User is offline   Lot 

  • W.R. Private
  • Group: Members
  • Posts: 23
  • Joined: 24-August 07
  • Gender:Male
  • Location:Georgia - USA
  • Interests:God Kay Music Guitar Web Design/Development

Posted 08 November 2007 - 08:47 AM

Forgetting to close those one-time tags can lead to headaches when you are trying to figure out why HTML Tidy is saying you have a syntax error.
0

#13 User is offline   temhawk 

  • W.R. Private First-Class
  • Group: Members
  • Posts: 322
  • Joined: 30-August 07
  • Gender:Male
  • Interests:travel, cg art, macs, music, skateboarding, programming, discovery channel, TextMate 2

Posted 08 November 2007 - 09:17 AM

HTML Tidy?

Is that W3's online HTML validator?

Your tip is registered, by the way :)
0

#14 User is offline   Lot 

  • W.R. Private
  • Group: Members
  • Posts: 23
  • Joined: 24-August 07
  • Gender:Male
  • Location:Georgia - USA
  • Interests:God Kay Music Guitar Web Design/Development

Posted 08 November 2007 - 10:09 AM

No, its a firefox extension that checks the validation of any page you are currently viewing.

https://addons.mozil...refox/addon/249


It's there.
0

#15 User is offline   temhawk 

  • W.R. Private First-Class
  • Group: Members
  • Posts: 322
  • Joined: 30-August 07
  • Gender:Male
  • Interests:travel, cg art, macs, music, skateboarding, programming, discovery channel, TextMate 2

Posted 08 November 2007 - 02:05 PM

Oh. Okay.

Thank you :)
0

#16 User is offline   Lot 

  • W.R. Private
  • Group: Members
  • Posts: 23
  • Joined: 24-August 07
  • Gender:Male
  • Location:Georgia - USA
  • Interests:God Kay Music Guitar Web Design/Development

Posted 08 November 2007 - 02:13 PM

Welcome, its a great tool
0

#17 User is offline   raman123 

  • W.R. Private
  • Group: Members
  • Posts: 1
  • Joined: 15-January 08

Posted 15 January 2008 - 06:31 AM

:thumbdown: :smilie_xp: :smilie_osx: :whistling1: :closedeyes: :notworthy: :rolleyes1: :sleeping: :whistling: :smilie_tux: :confused1: :surrender: Ans:-it doesn't matter.. u can use it in any way u like..
0

#18 User is offline   marcamos 

  • W.R. General
  • Group: Administrators
  • Posts: 2,849
  • Joined: 04-April 06
  • Gender:Male
  • Location:Massachusetts - USA

Posted 15 January 2008 - 06:50 AM

View Postraman123, on Jan 15 2008, 05:31 AM, said:

:thumbdown: :smilie_xp: :smilie_osx: :whistling1: :closedeyes: :notworthy: :rolleyes1: :sleeping: :whistling: :smilie_tux: :confused1: :surrender: Ans:-it doesn't matter.. u can use it in any way u like..

Welcome to :wr:, but I'm afraid you're wrong. Be sure to read through the thread in its entirety.
0

#19 User is offline   supasnail 

  • W.R. Corporal
  • Group: Members
  • Posts: 112
  • Joined: 19-September 07

Posted 15 January 2008 - 07:11 AM

View Postherkalees, on Jan 15 2008, 10:50 AM, said:

Welcome to :wr:, but I'm afraid you're wrong. Be sure to read through the thread in its entirety.


Good, you got in there just ahead of me lol.
Is this a new form of semantic spam though? I've noticed on a few forums 'newbie' members posting meaningless replies to very old threads but the post content somehow relates to the thread's content. Its interesting to think that as search engines strive to extract meaningful content, spammers can do likewise and create relevant spam posts.

This post has been edited by supasnail: 15 January 2008 - 07:12 AM

0

#20 User is offline   smoseley 

  • W.R. Private
  • Group: Members
  • Posts: 14
  • Joined: 15-January 08

Posted 16 January 2008 - 06:40 PM

View Posttemhawk, on Oct 14 2007, 09:27 AM, said:

I'm still against <br />.


There's no "for" or "against" - it's not up for argument.

<br> is appropriate for all HTML specs
<br /> is appropriate for all XHTML specs

Use the one that correctly matches the DOCTYPE you're using.
0

Share this topic:


  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • This topic is locked

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users