Line breaking...

Thread Solved

Join Date: Jan 2007
Posts: 19
Reputation: mbacon is an unknown quantity at this point 
Solved Threads: 0
mbacon mbacon is offline Offline
Newbie Poster

Line breaking...

 
0
  #1
Jan 17th, 2007
Hello There,

I was wondering what the purpose of using <br /> and \n are, instead of just the normal HTML line break. Does this make my code more compatible with older browsers or different operating systems?

Thanks,
Mike
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 5,273
Reputation: iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold 
Solved Threads: 378
Featured Poster
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Posting Expert

Re: Line breaking...

 
0
  #2
Jan 17th, 2007
Isn't <br> the bog standard way to do a new line anyway in html?

Also, I don't think operating system has anything to do with it? Web browsers and the way they render html are independant of OS.
*Voted best profile in the world*
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 7
Reputation: trombonecrazy is an unknown quantity at this point 
Solved Threads: 1
trombonecrazy trombonecrazy is offline Offline
Newbie Poster

Re: Line breaking...

 
0
  #3
Jan 17th, 2007
<br/> is an xhtml version of the standard <br> tag but I have never seen </n>. The answer to the compatibility is no it won't make it anymore compatible only if you have got xhtml set in your doc type.
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 19
Reputation: mbacon is an unknown quantity at this point 
Solved Threads: 0
mbacon mbacon is offline Offline
Newbie Poster

Re: Line breaking...

 
0
  #4
Jan 17th, 2007
Originally Posted by trombonecrazy View Post
<br/> is an xhtml version of the standard <br> tag but I have never seen </n>. The answer to the compatibility is no it won't make it anymore compatible only if you have got xhtml set in your doc type.
Hey,

Sorry for not being specific enough about the \n... I was referring to the ASCII control character for a NewLine... \r would be Return Carriage and \t would be Tab... etc. etc..

What is the difference between the control character and the linebreak tag?
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 1,091
Reputation: MattEvans is a jewel in the rough MattEvans is a jewel in the rough MattEvans is a jewel in the rough 
Solved Threads: 63
Moderator
Featured Poster
MattEvans's Avatar
MattEvans MattEvans is offline Offline
Veteran Poster

Re: Line breaking...

 
0
  #5
Jan 18th, 2007
The control character linebreaks \n or \r will be shown in your markup when you view it as plain text. They can be used to organise your code better.

When it's rendered as HTML, \n, \r linebreaks aren't shown atall. You have to use <br> or <br/> or <p></p> etc to show linebreaks in rendered HTML.
Last edited by MattEvans; Jan 18th, 2007 at 4:44 am.
Plato forgot the nullahedron..
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 19
Reputation: mbacon is an unknown quantity at this point 
Solved Threads: 0
mbacon mbacon is offline Offline
Newbie Poster

Re: Line breaking...

 
0
  #6
Jan 18th, 2007
Originally Posted by MattEvans View Post
The control character linebreaks \n or \r will be shown in your markup when you view it as plain text. They can be used to organise your code better.

When it's rendered as HTML, \n, \r linebreaks aren't shown atall. You have to use <br> or <br/> or <p></p> etc to show linebreaks in rendered HTML.
Thank you
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 3,210
Reputation: MidiMagic has a spectacular aura about MidiMagic has a spectacular aura about 
Solved Threads: 164
MidiMagic's Avatar
MidiMagic MidiMagic is offline Offline
Nearly a Senior Poster

Re: Line breaking...

 
0
  #7
Jan 24th, 2007
The correct form of the br tag is:

HTML and CSS Syntax (Toggle Plain Text)
  1. <br />

Note the space before the /. This makes the tag work (actually fail invisibly) on older browsers.

Single tags without closing tags or closing slashes are deprecated (a fancy word meaning they plan to discontinue it shortly).

So we either have to have tags in pairs:

HTML and CSS Syntax (Toggle Plain Text)
  1. <li>This is a list element.</li>

Or we have to show that the tag has no closing tag with a slash before the closing angle broket.

HTML and CSS Syntax (Toggle Plain Text)
  1. <hr />
  2. <img src="toon.jpg alt="cartoon of clown with stuffed helicopter" />

I think they did this so they could write code checking software which is not ambiguous.
Last edited by MidiMagic; Jan 24th, 2007 at 2:24 am.
Daylight-saving time uses more gasoline
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 1,091
Reputation: MattEvans is a jewel in the rough MattEvans is a jewel in the rough MattEvans is a jewel in the rough 
Solved Threads: 63
Moderator
Featured Poster
MattEvans's Avatar
MattEvans MattEvans is offline Offline
Veteran Poster

Re: Line breaking...

 
0
  #8
Jan 24th, 2007
Single tags without closing tags or closing slashes are deprecated (a fancy word meaning they plan to discontinue it shortly).
That's not true. In HTML the close tag or closing slash for lots of elements is optional. Unclosed tags are just illegal in XML and thus XHTML.

http://www.w3.org/TR/html4/intro/sgmltut.html
http://www.w3.org/TR/html4/index/elements.html
http://www.w3.org/TR/xhtml1/#h-4.3
Last edited by MattEvans; Jan 24th, 2007 at 11:06 am.
Plato forgot the nullahedron..
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 3,210
Reputation: MidiMagic has a spectacular aura about MidiMagic has a spectacular aura about 
Solved Threads: 164
MidiMagic's Avatar
MidiMagic MidiMagic is offline Offline
Nearly a Senior Poster

Re: Line breaking...

 
0
  #9
Jan 26th, 2007
Not when you have superiors or clients demanding the "latest code".

And how long do you expect W3C to allow HTML to remain on the Internet? We are being forced to change to HDTV in two years. What makes you think that this will be any different?
Daylight-saving time uses more gasoline
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 302
Reputation: sreein1986 is an unknown quantity at this point 
Solved Threads: 33
sreein1986's Avatar
sreein1986 sreein1986 is offline Offline
Posting Whiz

Re: Line breaking...

 
0
  #10
Jun 6th, 2008
I think that tag is between script tag

please check once total code

Thanx,
sree
Thanx,
Shiriyal

http://shiriyal.blogspot.com/
if you problem solved add me as a reputation and mark it mark as solved
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the HTML and CSS Forum
Thread Tools Search this Thread



Tag cloud for HTML and CSS
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC