使用下面的代码我可以看到chrome中的换行符,但不能在IE中看到。 我只是想在IE中也有同样的行为。
break {
white-space: pre;
}
<div class="ft13" style="padding-top: 15px" display:inline-block;>
<break>
Another difference between the source files of C++ and the source files of Java is that Java source is written in Unicode,
a 16-bit international character set standard. If you create an ASCII source file, the Java compiler will treat the ASCII characters as if they were the equivalent Unicode characters. This will be discussed at greater length in Chapter 3.
</break>
</div>
在IE中,上面的文字显示如下:(没有断行)
C ++的源文件和Java的源文件之间的另一个区别是Java源是用Unicode编写的,这是一个16位的国际字符集标准。如果创建ASCII源文件,Java编译器会将ASCII字符视为等效的Unicode字符。这将在第3章中详细讨论。
答案 0 :(得分:2)
<style type="text/css">
.break {
white-space: pre;
}
</style>
<div class="ft13" style="padding-top: 15px; display:inline-block;">
<div class="break">
Another difference between the source files of C++ and the source files of Java is that Java source is written in Unicode,
</div>
<div class="break">
a 16-bit international character set standard. If you create an ASCII source file, the Java compiler will treat the ASCII characters as if they were the equivalent Unicode characters. This will be discussed at greater length in Chapter 3.
</div>
</div>
答案 1 :(得分:1)
您可以使用<br/>
标记打破html中的文字内容,如下所示:
<div>
This text is in one line <br/>and this on another
</div>
此外,您的代码不正确:
<div class="ft13" style="padding-top: 15px" display:inline-block;>
应该是:
<div class="ft13" style="padding-top: 15px; display:inline-block;">
无论它意味着什么......
答案 2 :(得分:1)
默认情况下,IE不允许您设置自定义元素的样式。
您可以通过在JavaScript中创建标记实例来修复它。
<!--[if lt IE 9]>
<script type="text/javascript">
document.createElement('break');
</script>
<![endif]-->
此脚本应位于条件注释中的页面<head>
中以及任何样式表之后。
此解决方案的灵感来自html5shiv,允许您在IE中使用HTML5标记。您也可以使用它来启用自定义元素。
您可以在本文中了解有关此“黑客”的更多信息:How to get HTML5 working in IE
答案 3 :(得分:0)
我之前从未听说过<break>
。但你可以试试<br />
它对我有用。
答案 4 :(得分:0)
您应该使用<br/>
元素将内容推送到新行。
<break>
Another difference between the source files of C++ and the source files of Java is that Java source is written in Unicode,
<br/>a 16-bit international character set standard. If you create an ASCII source file, the Java compiler will treat the ASCII characters as if they were the equivalent Unicode characters. This will be discussed at greater length in Chapter 3.
</break>
答案 5 :(得分:0)
添加white-space:normal;
https://jsfiddle.net/kirandash/v5d9fd0r/
<强> HTML:强>
<div class="ft13" style="padding-top: 15px; display:inline-block;">
<break>
Another difference between the source files of C++ and the source files of Java is that Java source is written in Unicode,
a 16-bit international character set standard. If you create an ASCII source file, the Java compiler will treat the ASCII characters as if they were the equivalent Unicode characters. This will be discussed at greater length in Chapter 3.
</break>
</div>
<强> CSS:强>
break {
white-space: normal;
}
,否则强>
不需要自定义break元素。您可以使用<br/>
标记创建换行符。
<强> HTML:强>
<div class="ft13" style="padding-top: 15px; display:inline-block;">
Another difference between the source files of C++<br/> and the source files of Java is that Java source is written in Unicode, a 16-bit<br/> international character set standard. If you create an ASCII source file,<br/> the Java compiler will treat the ASCII characters as if they were the equivalent Unicode characters. This will be discussed at greater <br/>length in Chapter 3.
</div>
答案 6 :(得分:0)
您的意思是<pre>
吗?
<div class="ft13" style="padding-top: 15px; display:inline-block;">
<pre>
Another difference between the source files of C++ and the source files of Java is that Java source is written in Unicode,
a 16-bit international character set standard. If you create an ASCII source file, the Java compiler will treat the ASCII characters as if they were the equivalent Unicode characters. This will be discussed at greater length in Chapter 3.
</pre>
</div>
&#13;
答案 7 :(得分:0)
您是否为文档声明了doctype?
<!DOCTYPE html>
如果属实,我认为你应该尝试<br>
标签或
<br style="line-height:?px; height:?px" />
用?px表示你需要多少px。
了解详情