选择框中的选项没有响应

Syl*_*ain 5 html css php media-queries twitter-bootstrap

我的选择字段中的选项没有响应。

\n\n

在此输入图像描述

\n\n

我使用 php 循环来显示选项,我认为问题来自那里:

\n\n
<div class="form-group">\n      <label class="col-sm-2 control-label">S\xc3\xa9lectionner un article</label>\n            <div class="col-sm-10">\n                 <select class="form-control m-b-sm" name="a_idarticle" id="a_idarticle">\n                      <?php\n                         foreach ($allarticles as $aa) {\n                             echo \'<option value="\'.$aa[\'id_article\'].\'">\'.$aa[\'id_article\'].\'--\'.$aa[\'titre\'].\'</option>\';\n                         }\n                      ?>\n                </select>\n         </div>\n  </div>\n
Run Code Online (Sandbox Code Playgroud)\n\n

有谁知道解决方案吗?

\n

Nac*_* M. 2

一种解决方案是使用省略号

尝试更改表单中 select 和 option attr 的 CSS 属性:

CSS:

#a_idarticle, #a_idarticle option {
     text-overflow: ellipsis;
}
Run Code Online (Sandbox Code Playgroud)

参考文献: 下拉框中溢出文本的省略号

编辑以添加另一个解决方案: 此外,您可以使用按钮来包装下拉列表,如这篇文章中所示:Setting the width of a dropdown list in Bootstrap 3.0