Reputation: 113
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;
}
Upvotes: 10
Views: 32172
Reputation: 51
This works well for me as it wraps correctly with or without whitespace:
li {
word-break: break-all;
}
Upvotes: 1
Reputation: 311
Add white-space:normal to your CSS element:
word-break: normal;
white-space: normal;
Upvotes: 6