CSS,自动换行。这该怎么做?
我想说出这样的话:
O:
Which is the most horrifying thing/disease you have seen in your medical career?
To:
Which is the most horrifying
thing/disease you have seen
in your medical career?
我用word-wrap: break-word
但显示如下:
Which is the most horrifying t
hing/disease yo
u have seen in you
r medical career?
一种可能的解决方案是,如果您希望它是特定的宽度,那么您必须定义它。 例: HTML:
<p>Which is the most horrifying thing/disease you have seen in your medical career?</p>
CSS:
p {
width: 200px;
word-wrap: break-word;
}
请参阅https://css-tricks.com/almanac/properties/h/hyphenate/
连字符属性另外让你控制连字符。要正常运行,需要在父级上定义语言。最简单的方法就是改变
<body>
至
<body lang="en">