I want to wrap the words automatically within width.
<ul class="dropdown-menu" style="width:298px;margin:15px 0 0 0;">
<li>option 1 </li>
<li>option 2 option 2 option 2 option 2 option 2 option 2</li>
</ul>
It's now working fine with white-space:normal
ul li{
white-space:normal;
}
Please Try it...
ul li {
word-break: break-all;
}
Add white-space:normal to your CSS element:
word-break: normal;
white-space: normal;
This works well for me as it wraps correctly with or without whitespace:
li {
word-break: break-all;
}
use word-wrap:break-word;
works perfectly fine for me here is the jsfiddle
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.