Forcing a long line of text (without spaces) to line break according to parent containers static width using CSS
You can use this to wrap :
.wrap {
white-space: pre-wrap; /* CSS3 */
white-space: -moz-pre-wrap; /* Firefox */
white-space: -pre-wrap; /* Opera <7 */
white-space: -o-pre-wrap; /* Opera 7 */
word-wrap: break-word; /* IE */
}
How to wrap long lines without spaces in HTML?
I haven't personally used it, but Hyphenator looks promising.
Also see related (possibly duplicate) questions:
- word wrap in css / js
- Who has solved the long-word-breaks-my-div problem? (hint: not stackoverflow)
Break long text without spaces inside table cell
The secret is to use word-break:break-all
on each <td>
cell.
Alternatively you can use overflow-wrap
but behaves similar.
Note: In contrast to word-break, overflow-wrap will only create a break if an entire word cannot be placed on its own line without overflowing.
Here's a thorough article comparing them both
table{ width: 400px; border: 1px dashed salmon;}
table td{ vertical-align: top; padding: 5px; word-break: break-all; /* MUST ADD THIS */}
table td:nth-child(1){ text-align: right; width: 140px;}
<table> <tr> <td>Your name: <td>David </tr> <tr> <td>Your city: <td>Prageu </tr> <tr> <td>Your Informations: <td>myinfomyinfomyinfomyinfomyinfomyinfomyinfomyinfomyinfomyinfomyinfomyinfomyinfomyinfo </tr></table>
How to wrap a long text having no spaces in php
Use this:
<?php
$iamlong = "woooooooooooord.";
$iamwrapped = wordwrap($iamlong , 8, "<br>", true);
echo $iamwrapped;
?>
How can I force a long string without any blank to be wrapped?
for block elements:
<textarea style="width:100px; word-wrap:break-word;"> ACTGATCGAGCTGAAGCGCAGTGCGATGCTTCGATGATGCTGACGATGCTACGATGCGAGCATCTACGATCAGTC</textarea>
php how to wrap a very long word that has no spaces
Use CSS. Don't complicate things...
.rectangle { width: 200px; background: red; border: 1px solid #000; word-break: break-all;}
<div class="rectangle"> <p>DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD</p></div>
Wrap a word without spaces in a div
Try this:
word-wrap:break-word;
Related Topics
Move All Files in a Folder to Another
How to Insert Array of Data into MySQL Using PHP
Laravel 5 Controller Sending JSON Integer as String
How to Maintain Session in Curl in PHP
How to Include File Outside Document Root
How to Set for Specific Directory Open_Basedir
Paypal Gateway Has Rejected Request. Security Header Is Not Valid (#10002: Security Error Magento
How to Use Authentication for Multiple Tables in Laravel 5
PHP Exec: Does Not Return Output
PHP Dom Get Nodevalue HTML? (Without Stripping Tags)
Getting List Ips from Cidr Notation in PHP
Reaching 100% Code Coverage with PHPunit
How to Use C++ Binaries from PHP
Multi-Byte Safe Wordwrap() Function for Utf-8