Html 如何更改html中列表框的宽度?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5105715/
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
How to change the width of list box in html?
提问by Ahmad Farid
How to change the width of list box
如何更改列表框的宽度
<select id ="tagsList" class="ui-widget-content ui-corner-all" width="100" size="18" multiple="multiple">
I try width="100"
but it doesn't work
我尝试width="100"
但它不起作用
回答by Steven
You can set the width using inline css like this:
您可以使用内联 css 设置宽度,如下所示:
<select style="width: 100px;"></select>
In with the rest of your attributes.
与您的其他属性一起使用。
There are other ways to specify the width of an element, and most revolve around CSS. Here's a linkto Google's CSS education video that should get you more than primed and ready to go.
还有其他方法可以指定元素的宽度,并且大多数都围绕 CSS。这里有一个指向Google 的 CSS 教育视频的链接,它不仅能让您做好准备并做好准备。
回答by kgiannakakis
You need to use CSS:
您需要使用 CSS:
<select id="tagsList" style="width:100px;">
回答by Daniel A. White
You have to use CSS's width property. Add style="width: 100px;"
您必须使用 CSS 的 width 属性。添加style="width: 100px;"
回答by Rishi Rix
<select id ="tagsList" class="ui-widget-content ui-corner-all" style="width:100;" size="18" multiple="multiple">
this code almost your i just added that style that is enough
这段代码几乎是你的,我刚刚添加了足够的样式