我试图在我的幻灯片菜单中包装我的文本。我有ul最大宽度200px,但是当我写更长的文本,然后我的文本是不可见的(现在我添加溢出:可见,以显示你我的意思)。如何包装这个?css如何在li中包装文本
我的代码如下所示:
<nav class="navbar navbar-default" role="navigation">
<div class="dropdown">
<button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown">
Dropdown
<span class="caret"></span>
</button>
<ul class="dropdown-menu" style="max-width: 200px" role="menu" aria-labelledby="dropdownMenu1">
<li role="presentation" class="dropdown-header">Dropdown header</li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="#">Action</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="#">Another action</a></li>
<li role="presentation" class="disabled"><a role="menuitem" tabindex="-1" href="#">Something else here</a></li>
<li role="presentation" class="divider"></li>
<li role="presentation" class="dropdown-header">Dropdown header</li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="#">Separated link</a></li>
</ul>
</div>
</nav>
和CSS现在:
<style>
.dropdown .dropdown-menu {
-webkit-transition: all 0.3s;
-moz-transition: all 0.3s;
-ms-transition: all 0.3s;
-o-transition: all 0.3s;
transition: all 0.3s;
max-height: 0;
display: block;
overflow: hidden; <-- here i was trying to add word-wrap: break-word; but it doesn'twork
opacity: 0;
}
.dropdown.open .dropdown-menu {
max-height: 200px;
opacity: 1;
}
</style>
也尝试添加宽度为自动换行 –