Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Twitter bootstrap - break-word not work on dropdown-menu

I applied word-wrap: break-word to twitter bootstrap dropdown-nemu, but it didn't work. Here's the JSFiddle.

I tried a simplified sample and it worked:

<ul style="width: 60px">
    <li>
        <a style="word-wrap: break-word">fdsssssssssssssssssssssssssdfdsfsdfsdf</a>
    </li>
</ul>
like image 218
Trantor Liu Avatar asked Aug 26 '12 07:08

Trantor Liu


People also ask

Why bootstrap dropdown menu is not working?

Solution : The dropdown should be toggled via data attributes or using javascript. In the above program, we have forgotten to add a data attribute so the dropdown is not working. So add data-bs-toggle="dropdown" to toggle the dropdown.

Can you wrap text in a dropdown?

Unfortunately, there is no 'word-wrap' feature on Comboboxes or Dropdowns. All you can do is try to make the ComboBox wider or the text smaller.

How do I add a drop down menu in bootstrap?

To open the dropdown menu, use a button or a link with a class of . dropdown-toggle and the data-toggle="dropdown" attribute. The . caret class creates a caret arrow icon (), which indicates that the button is a dropdown.


1 Answers

It was because of white-space: nowrap property with link.. add this line:

<li><a href="#" style="word-wrap: break-word; white-space: normal;">sometextsometextsometextsometextsometext</a></li>

..or use full fiddle here: http://jsfiddle.net/Ex5fA/45/ (you had also typos with your .dropdown-menu selector.. it was typed .dorpdown-nenu ;)

like image 64
Mauno Vähä Avatar answered Dec 18 '22 02:12

Mauno Vähä