Html 当文本溢出并包含div时断行
我有这样的代码:Html 当文本溢出并包含div时断行,html,Html,我有这样的代码: <div> <ul> <li>This my text but it is too long and it is stick out from div becaue it has too many characters. And i want it text to break somewhere, beste break it in place where is blank character.</li>
<div>
<ul>
<li>This my text but it is too long and it is stick out from div becaue it has too many characters. And i want it text to break somewhere, beste break it in place where is blank character.</li>
<ul>
</div>
<div>
<ul>
<li style="width:150px;">This my text but it is too long and it is stick out from div becaue it has too many characters. And i want it text to break somewhere, beste break it in place where is blank character.</li>
<ul>
</div>
- 这是我的文本,但它太长了,而且它从div中突出,因为它有太多的字符。我希望文本在某个地方断开,最好在空白字符处断开
我希望自动完成类似的操作:
<div>
<ul>
<li>This my text but it is too long and it is stick out from div
becaue it has too many characters. And i want it text to break
somewhere, beste break it in place where is blank character.
</li>
<ul>
</div>
- 这是我的文本,但它太长,从div中突出
因为它有太多的字符。我要它断开
在某个地方,最好在空白字符处将其打断。
我可以用html和css来做这件事吗?或者我需要别的东西,也许是javascript?如果我可以这样做,有人能帮我吗?您需要在css文件中为您的li指定宽度:
li
{
width:150px;
}
或者像这样:
<div>
<ul>
<li>This my text but it is too long and it is stick out from div becaue it has too many characters. And i want it text to break somewhere, beste break it in place where is blank character.</li>
<ul>
</div>
<div>
<ul>
<li style="width:150px;">This my text but it is too long and it is stick out from div becaue it has too many characters. And i want it text to break somewhere, beste break it in place where is blank character.</li>
<ul>
</div>
- 这是我的文本,但它太长,并且从div中突出,因为它有太多的字符。我希望文本在某个地方断开,最好在空白字符处断开
看看这个:你可以在你想要断线的地方用“
”来做你自己的线路刹车。我知道,但如果我制作包含嵌套列表的嵌套列表最多63次,那就不那么容易了。在我的应用程序中,这是一个更复杂的问题,因为列表的内容是用户的事情。但是谢谢你回答我的问题。