13

break line tag is not working in firefox, neither in chrome. When i see the source of my page i get:

<p>Zugang zu Testaccount:</br></br>peter petrelli </br></br>sein Standardpwd.</br></br>peter.heroes.com</p>

However when i do view selected source, i get:

<p>Zugang zu Testaccount: peter petrelli  sein Standardpwd. peter.heroes.com</p>

It seems firefox is filtering break line tags out.

It works in IE7 fine.

Dana
  • 32,083
  • 17
  • 62
  • 73
Sergio del Amo
  • 76,835
  • 68
  • 152
  • 179

14 Answers14

66

You're looking for <br /> instead of </br>

Self closing tags such as br have the slash at the end of the tag.

Here are the other self-closing tags in XHTML:

Community
  • 1
  • 1
Jason Navarrete
  • 7,495
  • 6
  • 28
  • 22
15

If you are trying to put space between two divs and <br/> is not working then insert this code (between the divs) to get the <br/> tag working.

<div class="clear"></div>

and add

.clear {
    clear: both;
}

in your css file.

Kunal Kumar
  • 1,139
  • 14
  • 13
11

The br tag should be:

<br/>
Alaa
  • 115
  • 12
andyuk
  • 38,118
  • 16
  • 52
  • 52
11

It should be <br> or <br /> not </br>

curtisk
  • 19,950
  • 4
  • 55
  • 71
6

IE7 is more forgiving of incorrect syntax in quirksmode.

Instead of <br> or </br> it should be <br />

Adam Kinney
  • 1,075
  • 7
  • 5
3

That's because </br> is an invalid tag. What you want is <br />.

Dan
  • 31
  • 2
1


should probably be used only if you are writing XHTML. If you use validator.w3.org to validate the following as HTML 4.01:

<html>
<head>
<title></title>
</head>
<body>
<p>
<br />
</p>
</body>
</html>

This warning is generated:

Line 8, Column 3: NET-enabling start-tag requires SHORTTAG YES.

<br />

The sequence can be interpreted in at least two different ways, depending on the DOCTYPE of the document. For HTML 4.01 Strict, the '/' terminates the tag '). However, since many browsers don't interpret it this way, even in the presence of an HTML 4.01 Strict DOCTYPE, it is best to avoid it completely in pure HTML documents and reserve its use solely for those written in XHTML.

Grant Wagner
  • 25,263
  • 7
  • 54
  • 64
0

It should just be <br>.

nsanders
  • 12,250
  • 2
  • 40
  • 47
0

You want <BR> or <BR />, not </BR>

moonshadow
  • 86,889
  • 7
  • 82
  • 122
0

If you are using struts set escapeXml="false"

0

It’s not </br>, it’s <br> or <br />.

So, this doesn’t work as expected:

<!doctype html>
<html>
 <head>
  <title></title>
 </head>
 <body>
  <p>
   Some text... </br>
   Some more text...
  </p>
  More content...
 </body>
</html>

But this works:

<!doctype html>
<html>
 <head>
  <title></title>
 </head>
 <body>
  <p>
   Some text... <br>
   Some more text... <br />
  </p>
  More content...
 </body>
</html>
UserName Name
  • 267
  • 2
  • 3
0

For me CSS was an issue.

For this tag display: none; was used so <br> tag was not rendering.

Ramratan Gupta
  • 1,056
  • 3
  • 17
  • 39
0

Well I would recommend not using </br> instead try <br />. Using <br /> instead of </br> ensures proper line breaks and should work consistently across all modern browsers, including Firefox, Chrome, and Internet Explorer.
Also try this updated code:

<p>Zugang zu Testaccount:<br /><br />peter petrelli <br /><br />sein Standardpwd.<br /><br />peter.heroes.com</p>

I hope it would work fine with this.

  • Welcome to Stack Overflow! This answer is the same as (or very similar to) the accepted one. It would be better to upvote that answer instead of posting it again. Invest some time in the site and you will gain sufficient [privileges](//stackoverflow.com/privileges) to upvote answers that helped you. – LW001 Aug 06 '23 at 15:47
-2

Alternatively to <br /> or <br> you can use <p></p> or </p>

Tim Stack
  • 3,209
  • 3
  • 18
  • 39