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

Recommended Answers

All 10 Replies

Member Avatar for iamthwee

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.

<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.

<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?

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.

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 :)

The correct form of the br tag is:

<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:

<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.

<hr />
<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.

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?

I think that tag is between script tag

please check once total code

Thanx,
sree

I think that tag is between script tag

please check once total code

Thanx,
sree

I think the post is over year old. Don't yoy think it is either solved or poster long forgoten about and moved on?
If you have no valuable information to pass, please do not re-open old threads!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.