I am using <code>
tag to wrap inline code and breaking the long words using the overflow-wrap: break-word;
property. It is only working in Chrome and Firefox, but not in IE 11. So far I have tried word-wrap
, word-break
, and even -ms-word-break
. Here is the fiddle.
Does anyone know how to break lines in IE 11?
答案 0 :(得分:0)
如果需要,您的文本将会换行,因此您必须设置容器的宽度以强制它像这样包装:
<!DOCTYPE html>
<html>
<head>
<style>
code {
background-color: #f7f7f7;
/* padding: 0px 2px; */
color: rgb(232, 76, 128);
/*word-wrap: break-word; */
/*-ms-word-break: break-word;*/
word-break: break-all;
overflow-wrap: break-word;
}
p{
width:25%;
}
</style>
</head>
<body>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod <CODE>a.long.keyword.which.i.want.to.break</CODE>
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</body>
</html>
这是你想做的吗?