默认情况下,
option的宽度会由options中最宽的元素决定,并且同时决定着select控件的宽度
在Yii中,如果需要自定义select控件的宽度,可以用 htmlOptions定义,如下:
<td colspan=1>

<?php echo CHtml::label('新闻来源: ', ''); ?>
<?php echo CHtml::dropDownlist('source',

$currentSelectSource,

CHtml::listData($modelSource, 'domain_hash', 'site_name'),

array('empty'=>'-- 全 部 --',
'style'=>'width:200px;')

);?>

</td>


如果要自定义option的宽度,就没办法了,只能写CSS来定义。


 <style>


 form#form option{
    width:200px;
 }


 </style>


Yii 控制dropdownlist / select 控件的宽度和 option 的宽度的更多相关文章

  1. Jquery 操作Html 控件 CheckBox、Radio、Select 控件 【转】http://www.cnblogs.com/lxblog/archive/2013/01/09/2853056.html

    Jquery 操作Html 控件 CheckBox.Radio.Select 控件   在使用 Javascript 编写前台脚本的时候,经常会操作 Html 控件,比如 checkbox.radio ...

  2. Jquery 操作Html 控件 CheckBox、Radio、Select 控件

    在使用 Javascript 编写前台脚本的时候,经常会操作 Html 控件,比如 checkbox.radio.select,用 Jquery 库操作其他会方便很多,下面用Jq对这些控件的操作进行一 ...

  3. IE6/7下Select控件Display属性无效解决办法

    HTML的Select控件,C#的DropDownList服务器控件 设置父类型Display属性之后,在IE6/7上无效 直接将下段javascript脚本添加到页面中即可 <script t ...

  4. jquery 双向select控件bootstrap Dual listbox

    http://www.cnblogs.com/hangwei/p/5040866.html       -->jquery 双向select控件bootstrap Dual listboxhtt ...

  5. SELECT控件操作的JS代码示例

    SELECT控件操作的JS代码示例 1 检测是否有选中 if(objSelect.selectedIndex > -1) { //说明选中 } else { //说明没有选中 } 2.动态创建s ...

  6. HTML的select控件美化

    HTML的select控件美化 CSS: .div-select { border: solid 1px #999; height: 40px; line-height: 40px; cursor: ...

  7. IE6下div层被select控件遮住的问题解决方法

    Select在IE6下是处于最顶层的,因此想要遮住它,设置zIndex属性是不行的,就需要一个优先级更高的元素,就是iframe,当把iframe嵌套在弹出div层中后,把iframe设置为不可见,但 ...

  8. .net获取select控件中的文本内容

    .net获取select控件中的文本内容 2009-11-28 21:19小V古 | 分类:C#/.NET | 浏览1374次 <select id="SecType" st ...

  9. js+CSS实现模拟华丽的select控件下拉菜单效果

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

随机推荐

  1. 【ASP.NET Web API教程】5.5 ASP.NET Web API中的HTTP Cookie

    原文:[ASP.NET Web API教程]5.5 ASP.NET Web API中的HTTP Cookie 5.5 HTTP Cookies in ASP.NET Web API 5.5 ASP.N ...

  2. cct,web技术

    基本信息 全国计算机等级考试二级教程——Web程序设计(2016年版)作    者:教育部考试中心 编出 版 社:高等教育出版社出版时间:20115-12-1 ISBN:9787040442991版 ...

  3. centos6安装bt工具transmission

    centos6 install transmission 1.  安装所需的组件: yum -y install gcc gcc-c++ m4 make automake libtool gettex ...

  4. VirtualBox,Kernel driver not installed (rc=-1908)

    http://hi.baidu.com/spt_form/item/316d6207b47b8ee03499020a VirtualBox,Kernel driver not installed (r ...

  5. ANSI C中取得结构体字段偏移量的常用方法

    来自http://blog.chinaunix.net/u2/62910/showart_492571.html 假设在ANSI C程序中定义了一个名为MyStruct的结构类型,其中有一个名为MyF ...

  6. XPSP2 PSDK(还有lostspeed)

    XPSP2 PSDK Full Download with Local Install Use the full download to copy the entire Windows XP SP2 ...

  7. SilkTest Q&A 5

    Q41.VerifyBitmap的问题. 我正在使用函数VerifyBitmap比较位置,边,颜色等,例如: Window.VerifyBitmap("Position.bmp", ...

  8. RSA密码系统 基于大数环境编写 密码学课程设计

    RSA密码系统的实现 1.问题描述 RSA密码系统可具体描述为:取两个大素数p和q,令n=pq,N=(p-1)(q-1),随机选择整数d,满足gcd(d,N)=1,ed=1 modN. 公开密钥:k1 ...

  9. [Android学习笔记]使用ListView

    简单使用ListView 关键在于Adatper Adatper用来连接UI与数据源.Adapter既负责提供数据,又负责创建Item视图. 一般步骤: 1.创建list_item.xml,用来创建L ...

  10. 解决编译apache出现的问题:configure: error: APR not found . Please read the documentation - ____哊.時^随记 - 51CTO技术博客

    解决编译apache出现的问题:configure: error: APR not found . Please read the documentation - ____哊.時^随记 - 51CTO ...