如何更改下拉气泡的宽度?

时间:2014-05-19 12:52:57

标签: javascript jquery html css

我有以下html和css,只需点击一下按钮即可创建一个弹出菜单。我希望能够改变气泡的宽度,我该怎么做?

这是下拉气泡的样子:http://puu.sh/8St3e.png

screenshot http://puu.sh/8St3e.png

<div class="dropdown" style="display:inline">
    <button data-toggle="dropdown" class="btn btn-success" type="button" id="pops" >Select Populations</button>
    <ul id="popupDropDown" class="dropdown-menu" role="menu" aria-labelledby="dLabel" width="500px">    
    </ul>
</div>


.dropdown-menu:before {
  position: absolute;
  top: -7px;
  left: 9px;
  display: inline-block;
  border-right: 7px solid transparent;
  border-bottom: 7px solid #ccc;
  border-left: 7px solid transparent;
  border-bottom-color: rgba(0, 0, 0, 0.2);
  content: '';
}

.dropdown-menu:after {
  position: absolute;
  top: -6px;
  left: 10px;
  display: inline-block;
  border-right: 6px solid transparent;
  border-bottom: 6px solid #ffffff;
  border-left: 6px solid transparent;
  content: '';
}

1 个答案:

答案 0 :(得分:0)

您需要从<ul id="popupDropDown" class="dropdown-menu" role="menu" aria-labelledby="dLabel" width="500px">中删除此内联样式,以便它如下所示:

<ul id="popupDropDown" class="dropdown-menu" role="menu" aria-labelledby="dLabel">

然后你可以用css设置宽度,或者(更好)不加宽度让它随内容弯曲。