如何固定 <html:select> 组合框的大小(内容可能更大,但组合大小应该固定)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2781639/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 02:58:06  来源:igfitidea点击:

How to fix the size of the <html:select> combo box (contents may be larger but the combo size should be fixed)

htmlstruct

提问by DSB

How to fix the size of the combo box (contents may be larger but the combo size should be fixed).Now my combo size is changed based on the items in the combo.

如何固定组合框的大小(内容可能更大,但组合大小应该是固定的)。现在我的组合大小是根据组合中的项目改变的。

I'm trying to get something similar to the yahoo sign up page security Question combo: https://edit.yahoo.com/registration?.src=fpctx&.intl=in&.done=http://in.yahoo.com/

我正在尝试获得类似于雅虎注册页面安全问题组合的内容:https: //edit.yahoo.com/registration?.src =fpctx &.intl =in &.done =http: //in.yahoo.com /

my code: Text which decides the size of the combo

我的代码:决定组合大小的文本

回答by vooD

<select style="width: 100px">
  <option>Veeeeeeeeeeeeeeeery lllllllllllllloooong option</option>
</select>

or even better

甚至更好

<style>
.fixed-size  {
  width: 100px;
}
</style>

<select class="fixed-size">
  <option>Veeeeeeeeeeeeeeeery lllllllllllllloooong option</option>
</select>

回答by Tobias Rundbom

Set the css style to "width:100px" or whatever width you want the combo box to be.

将 css 样式设置为“width:100px”或您希望组合框的任何宽度。