【问题标题】:CSS select + select How to get first selectCSS select + select 如何获得第一个选择
【发布时间】:2015-03-26 23:09:49
【问题描述】:

请帮帮我!!

在这种情况下我不能先选择:

select+select{
   width: 50%;
}

我想为两个选择控件设置相同的宽度。

注意:我不能为选择设置不同的类,因为这是一个由 symfony ->render() 渲染的小部件 HTML。

<div>
  <select>
    <option>...</option>
  </select>

  <select>
    <option>...</option>
  </select>

</div>

PD:对不起我的英语不好。

【问题讨论】:

    标签: html css symfony-1.4


    【解决方案1】:

    如果要将两个选择设置为相同的宽度,请使用:

    select { width: 50% }
    

    您的示例集在第二次选择时将宽度设置为 50%。

    【讨论】:

      【解决方案2】:

      您需要使用:first-child selector

      select:first-child {
        width: 50%;
      }
      

      【讨论】:

        猜你喜欢
        • 2017-11-26
        • 2010-11-27
        • 1970-01-01
        • 2019-04-01
        • 1970-01-01
        • 2010-11-30
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多