Jquery选择菜单 - 如何为下拉菜单设置固定宽度 [英] Jquery Select Menu - How to set fixed width for the Drop down menu

查看:190
本文介绍了Jquery选择菜单 - 如何为下拉菜单设置固定宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我正在为我的移动应用程序使用Jquerymobile UI。在这个应用程序中我有一个下拉菜单,其值是从动态DB加载的。有些值很大所以下拉大小根据值长度而变化。它给我的UI设计不好看。如何将固定宽度设置为选择菜单,



我已经尝试了通过css,但没有工作



选择

{

widht:150px; !重要

}





非常类似于这个问题:http://stackoverflow.com/q/12119572/2802020 [ ^ ]





任何其他想法???





我的代码:



Hi,

I am using Jquerymobile UI for my mobile application. In this application i have one drop down menu, its values are loaded from DB dynamically..Some values are large so Drop down size changes according to the value length.It gives My UI design bad look. How to set Fixed width to Select menu,

I have tried the by css,but not working

select
{
widht:150px; !important
}


very similar to this problem: http://stackoverflow.com/q/12119572/2802020[^]


any other idea???


My code:

<table align="center" cellpadding="0px" cellspacing="0px" style="width: 100%; background-color: White;padding: 15px">
         <tr>

             <td width="70%;" style="border-bottom: 1px solid #837B6C;">

       <span style="font-family: Helvetica; font-size: 12px; color: #837B6C;    margin-left: 10px;">
        Item:</span>
         <select id="ddItem" style="width:100%; border:1px solid            #000;color:#000000; font-family:Georgia,serif;" data-theme="a" data-mini="true" data-inline="true">
                                             <option value="dd">sfdgsdfgsdfyurt6yueryturtyurtyuserytwsrthyserthsdth</option>
                                             <option value="dd"&       gt;5367345634562345623452345</option>
                                             <option value="dd">SFSSDCSDFxdghdfg</option>
                                             <option value="dd">S$FVDE%#Vaert</option>
                                             <option value="dd">HG#%#$@@34343dfghdfgh</option>
                                       </select>

                                </td>

                                <td width="30%" style="border-bottom: 1px solid #837B6C;">

                                                <span style="font-family: Helvetica; font-size: 12px; color: #837B6C; margin-left: 10px;">
                                                    Quantity:</span>

                                                <input name="" id="Text4" placeholder="" value="" data-mini="true" />

        </td>
    </tr>
</table>

推荐答案

FVDE%#Vaert < / option >
< 选项 value = dd > HG#%#
FVDE%#Vaert</option> <option value="dd">HG#%#


@@ 34343dfghdfgh < / option >
< / select >

< / td >

< td width = 30% < span class =code-attribute> style = border-bottom:1px solid#837B6C; >

< span style = font-family:Helvetica; font-size:12px;颜色:#837B6C; margin-left:10px; >
数量:< < span class =code-leadattribute> / span >

< ; 输入 名称 < span class =code-keyword> = id = Text4 占位符 = value = data-mini = true / >

< / td >
< / tr < span class =code-keyword>>
< / table >
@@34343dfghdfgh</option> </select> </td> <td width="30%" style="border-bottom: 1px solid #837B6C;"> <span style="font-family: Helvetica; font-size: 12px; color: #837B6C; margin-left: 10px;"> Quantity:</span> <input name="" id="Text4" placeholder="" value="" data-mini="true" /> </td> </tr> </table>


而不是使用



我用
Instead of using

I modified the codes with
修改了代码



它运作良好。


And it worked good.


这篇关于Jquery选择菜单 - 如何为下拉菜单设置固定宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆