【问题标题】:In IE8,chrome the dropdown-list takes the same width as the dropbox whereas in IE9 the dropdown-list's width varies.How it can be fixed?在 IE8 中,chrome 下拉列表的宽度与下拉框的宽度相同,而在 IE9 中,下拉列表的宽度不同。如何修复?
【发布时间】:2015-11-09 17:56:42
【问题描述】:
 .inpTxtE
 {
  font: 11px verdana;
  background-color:#FFFFFF;
  border-right: #7F9DB9 1px solid;
  border-top: #7F9DB9 1px solid;
  border-left: #7F9DB9 1px solid;
  border-bottom: #7F9DB9 1px solid;
  width:70%;
}

但当宽度为 72% 时,它与 IE9 中的其他宽度相同。但是当它在 chrome 下拉菜单中打开时,宽度大于其他文本框。

  <asp:DropDownList ID="ddlStatus" runat="server" CssClass="inpTxtE" >
                                    </asp:DropDownList>

这是我使用的代码。我将如何解决这个问题?

【问题讨论】:

    标签: c# css asp.net internet-explorer


    【解决方案1】:
     <!DOCTYPE html>
    <html>
        <head>
      <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7;IE=10; IE=9;" />
            <style type="text/css">
                    input, select {
                        -moz-box-sizing: border-box;
                        -webkit-box-sizing: border-box;
                        box-sizing: border-box;
                    }
            </style>
        </head>
        <body>
            <input type="text" value="ABC"><br>
            <select>
                <option>1234567</option>
                <option>121212121212121</option>
                <option>12121212121212121212</option>
            </select>
        </body>
    </html>
    

    【讨论】:

      【解决方案2】:
          <!DOCTYPE html>
          <html>
              <head>
                  <style type="text/css">
                          input, select {
                              width: 200px;
                              border: 1px solid #000;
                              padding: 0;
                              margin: 0;
                              height: 22px;
                              -moz-box-sizing: border-box;
                              -webkit-box-sizing: border-box;
                              box-sizing: border-box;
                          }
                          input {
                              text-indent: 4px;
                          }
                  </style>
              </head>
              <body>
                  <input type="text" value="ABC"><br>
                  <select>
                      <option>1234567</option>
                      <option>121212121212121</option>
                      <option>12121212121212121212</option>
                  </select>
              </body>
          </html>
      

      【讨论】:

      • 这段代码应该可以工作....我希望。如果有效,请将其标记为已回答。我在 jsfiddle 中对其进行了测试,它对我有用。
      • 如何获取 & 的控制权,而不是输入和选择。
      • 下拉菜单中没有应用边框颜色。
      • 通常在 css 中我们使用 input:not([type]), input[type="text"], select.....您也可以查看 bootstrap 文档并向下滚动到选择部分。 getbootstrap.com/css/#forms
      猜你喜欢
      • 2023-02-19
      • 2010-09-09
      • 2013-08-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-12-14
      • 2012-04-24
      • 2012-12-05
      相关资源
      最近更新 更多