Internet Explorer 11自动换行不起作用

wes*_*ley 45 html css internet-explorer

在IE 11中,自动换行不再适用于textarea元素.在IE 10及更早版本中,FF,Safari和Chrome自动换行按预期工作.

IE 11没有实现任何自动换行.我尝试在textarea标签中添加"wrap = hard",并添加"word-wrap:normal;" 到CSS.

还有其他人遇到过这个问题吗?如果是这样,你找到了解决方案.Windows正在推出此更新,并且不一致的行为正在成为一个问题.

感谢您的任何帮助,您可以提供.

这是我当前的textarea标签

<textarea class="wrklst-report_text" id="report_text_6586427" name="report_text[6586427]" title="Report Box" data-exam_seq="6586427" style="width:95%;"></textarea>
Run Code Online (Sandbox Code Playgroud)

这是我的计算CSS

-webkit-appearance: textarea;
-webkit-rtl-ordering: logical;
-webkit-user-select: text;
-webkit-writing-mode: horizontal-tb;
background-color: rgb(255, 255, 255);
border-bottom-color: rgb(0, 0, 0);
border-bottom-style: solid;
border-bottom-width: 1px;
border-image-outset: 0px;
border-image-repeat: stretch;
border-image-slice: 100%;
border-image-source: none;
border-image-width: 1;
border-left-color: rgb(0, 0, 0);
border-left-style: solid;
border-left-width: 1px;
border-right-color: rgb(0, 0, 0);
border-right-style: solid;
border-right-width: 1px;
border-top-color: rgb(0, 0, 0);
border-top-style: solid;
border-top-width: 1px;
color: rgb(0, 0, 0);
cursor: auto;
display: inline-block;
flex-direction: column;
font-family: Verdana, Arial, sans-serif;
font-size: 16px;
height: 300px;
letter-spacing: normal;
line-height: normal;
margin-bottom: 0px;
margin-left: 0px;
margin-right: 0px;
margin-top: 0px;
padding-bottom: 2px;
padding-left: 2px;
padding-right: 2px;
padding-top: 2px;
resize: both;
text-align: start;
text-indent: 0px;
text-shadow: none;
text-transform: none;
white-space: pre-wrap;
width: 950px;
word-spacing: 0px;
word-wrap: break-word;
writing-mode: lr-tb;
Run Code Online (Sandbox Code Playgroud)

joh*_*agh 74

为了确保将来访问此问题的人明白答案:OP(wesley)在问题下面的评论中自己回答了问题:

问题的原因是Internet Explorer 11使textarea元素继承了white-space应用于直接父级的任何属性.

该决议适用white-space: pre-wrapJean-FrançoisBeauchamp所确定的文本区域.


Yll*_*shi 13

添加CSS

 {width: 100%} 
Run Code Online (Sandbox Code Playgroud)

这会将文本包装到其标记中


bpy*_*ner 7

我来这里是因为一个不同的问题,即自动换行在 IE11 上不起作用;

{width: 100%}解决方案确实对我有用。


Phi*_*hil 5

我有一个类似的问题,并通过将自动换行样式更改为断字样式来解决它:

{ word-break: break-all; }
Run Code Online (Sandbox Code Playgroud)