Html </br> 不适用于 Firefox 和 chrome
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/158539/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
</br> not working in firefox and chrome
提问by Sergio del Amo
break line tag is not working in firefox, neither in chrome. When i see the source of my page i get:
break line 标签在 firefox 中不起作用,在 chrome 中也不起作用。当我看到我的页面的来源时,我得到:
<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.
Firefox 似乎正在过滤断行标记。
It works in IE7 fine.
它在 IE7 中运行良好。
回答by Jason Navarrete
You're looking for <br />
instead of </br>
你正在寻找<br />
而不是</br>
Self closing tags such as brhave the slash at the end of the tag.
自闭标签如br在标签末尾有斜线。
Here are the other self-closing tags in XHTML:
以下是 XHTML 中的其他自闭合标签:
回答by Kunal
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 之间放置空间并且<br/>
不起作用,则插入此代码(在 div 之间)以使<br/>
标签工作。
<div class="clear"></div>
and add
并添加
.clear {
clear: both;
}
in your css file.
在你的 css 文件中。
回答by andyuk
The br tag should be:
br 标签应该是:
<br/>
回答by curtisk
It should be <br>
or <br />
not</br>
它应该是<br>
或<br />
不</br>
回答by Adam Kinney
IE7 is more forgiving of incorrect syntax in quirksmode.
IE7 更能容忍 quirksmode 中的错误语法。
Instead of <br>
or </br>
it should be <br />
而不是<br>
或</br>
应该是<br />
回答by Dan
That's because </br>
is an invalid tag. What you want is <br />
.
那是因为</br>
是无效标签。你想要的是<br />
.
回答by Grant Wagner
should probably be used only if you are writing XHTML. If you use validator.w3.org to validate the following as HTML 4.01:
应该只在您编写 XHTML 时使用。如果您使用 validator.w3.org 将以下内容验证为 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.
第 8 行,第 3 列:启用 NET 的开始标签需要 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.
根据文档的 DOCTYPE,可以以至少两种不同的方式解释序列。对于 HTML 4.01 Strict,'/' 终止标签 ')。但是,由于许多浏览器不会以这种方式解释它,即使存在 HTML 4.01 Strict DOCTYPE,最好在纯 HTML 文档中完全避免它,并将其仅用于那些用 XHTML 编写的文档。
回答by Thushara Buddhika
If you are using struts set escapeXml="false"
如果你使用的是struts set escapeXml="false"
回答by moonshadow
You want <BR> or <BR />, not </BR>
你想要<BR>或<BR />,而不是</BR>
回答by nsanders
It should just be <br>.
它应该只是<br>。