简体   繁体   English

段落文字不会环绕到下一行

[英]Paragraph text doesn't wrap around to next line

I am trying to create text that will wrap around to the next line when it overflows. 我正在尝试创建将在溢出时环绕到下一行的文本。 Currently when it overflows it creates an entirely new line and puts the text on that line. 当前,当它溢出时,它将创建一个全新的行并将文本放在该行上。 What I would like is for the text to fill the first line and then wrap around to a new line. 我想要的是文本填充第一行,然后环绕到新行。

Code: 码:

 <div> <p style="width: 15em; display: inline-block;">[100 bytes] Input Script:</p> <p style="display: inline-block; overflow-x: auto;"> <span style="overflow-x: auto;"> 034840082CFABE6D6DFF54D028353549F5600B28A1757828F1B0E9ECCC0322435BA6D8CA1D76442A6A08000000F09F909F00144D696E65642062792072656E6A69616E66656E670000000000000000000000000000000000000000000000000000000000 </span> </p> </div> 

I have also tried setting the text to the different word-wrap values with no avail. 我也尝试将文本设置为不同的word-wrap值,但无济于事。 This has probably been answered millions of times, but I cannot find a solution which works in this situation. 这可能已经回答了数百万次,但是我找不到在这种情况下可行的解决方案。

Any help is appreciated, Thanks! 任何帮助表示赞赏,谢谢!

Set word-break: break-all; 设置word-break: break-all; on your <p> 在您的<p>

http://jsfiddle.net/rfo7ut2a/2/ http://jsfiddle.net/rfo7ut2a/2/

You want the word-break property : 您需要断字属性

 span { word-break: break-all; } 
 <div> <p style="width: 15em; display: inline-block;">[100 bytes] Input Script:</p> <p style="display: inline-block; overflow-x: auto;"> <span style="overflow-x: auto;"> 034840082CFABE6D6DFF54D028353549F5600B28A1757828F1B0E9ECCC0322435BA6D8CA1D76442A6A08000000F09F909F00144D696E65642062792072656E6A69616E66656E670000000000000000000000000000000000000000000000000000000000 </span> </p> </div> 

Try the code below and see if it works for you. 试试下面的代码,看看它是否适合您。

 <div style=" display: -webkit-box;word-wrap:break-word;"> <p>[100 bytes] Input Script:</p> <p style=overflow-x: auto;"> <span style="overflow-x: auto;"> vdnbvhbsdh vbjsf dbvbdjfbsa ddddddddd ddKVZHSDBVkjsdvbJ HVBDHBSDHJV BSHDVBDHVSJBDJHm dsjzhvjhmdvjmhbsjfhvvlnbsfdhbzv skjhbvhjkzsbvhjzsdbvhb zvkhfnkhfnkjnfkbjndfkjbnkjnbzkjnbkjfdnbkjdnkjb </p> </div> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM