<small id='ThgwB'></small><noframes id='ThgwB'>

    • <bdo id='ThgwB'></bdo><ul id='ThgwB'></ul>
    <tfoot id='ThgwB'></tfoot>
    1. <i id='ThgwB'><tr id='ThgwB'><dt id='ThgwB'><q id='ThgwB'><span id='ThgwB'><b id='ThgwB'><form id='ThgwB'><ins id='ThgwB'></ins><ul id='ThgwB'></ul><sub id='ThgwB'></sub></form><legend id='ThgwB'></legend><bdo id='ThgwB'><pre id='ThgwB'><center id='ThgwB'></center></pre></bdo></b><th id='ThgwB'></th></span></q></dt></tr></i><div id='ThgwB'><tfoot id='ThgwB'></tfoot><dl id='ThgwB'><fieldset id='ThgwB'></fieldset></dl></div>

        <legend id='ThgwB'><style id='ThgwB'><dir id='ThgwB'><q id='ThgwB'></q></dir></style></legend>
      1. 特定项目(选项)HTML 中的列表框样式

        时间:2023-10-13
      2. <small id='5V9o6'></small><noframes id='5V9o6'>

          <bdo id='5V9o6'></bdo><ul id='5V9o6'></ul>

            1. <legend id='5V9o6'><style id='5V9o6'><dir id='5V9o6'><q id='5V9o6'></q></dir></style></legend>
                <tbody id='5V9o6'></tbody>

              <tfoot id='5V9o6'></tfoot>

                • <i id='5V9o6'><tr id='5V9o6'><dt id='5V9o6'><q id='5V9o6'><span id='5V9o6'><b id='5V9o6'><form id='5V9o6'><ins id='5V9o6'></ins><ul id='5V9o6'></ul><sub id='5V9o6'></sub></form><legend id='5V9o6'></legend><bdo id='5V9o6'><pre id='5V9o6'><center id='5V9o6'></center></pre></bdo></b><th id='5V9o6'></th></span></q></dt></tr></i><div id='5V9o6'><tfoot id='5V9o6'></tfoot><dl id='5V9o6'><fieldset id='5V9o6'></fieldset></dl></div>
                • 本文介绍了特定项目(选项)HTML 中的列表框样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在尝试做出这种行为.

                  I'm trying to make this behavior.

                  当一个有一个列表框(或组合框)时,我的第一个元素(类似于选择一个")应该有一个特定的样式.

                  When a have a listBox (or comboBox), my first element (something like "choose one") should have a particular style.

                  使用这个(测试)代码:

                  With this (test) code:

                  <style type="text/css">
                   .testX {font-style: italic;}
                  </style>
                  
                  (...)
                  
                  <select name="name" id="id">
                  
                  <option class="testeX" selected="selected" value="#">
                      <p class="testX">Choose One</p>
                  </option>
                  <option value="TestValue">
                      TestValue
                  </option>
                  

                  当我展开列表框时,我可以在 Firefox(但在 Chrome 中看不到)上看到这种行为,但是当我选择选择一个"时,我的字段没有(斜体)样式.

                  i can see this behavior on Firefox (but not in Chrome) when i expand my listBox but when i select my 'Choose one' my field doesn't have the (italic) style.

                  我该怎么做?是否可以仅使用 HTML、CSS 或我需要更多(如 jQuery)来做到这一点?

                  How can i do this? Is possible do this only with HTML, CSS or i need more (like jQuery)?

                  谢谢.

                  推荐答案

                  斜体不适用于chrome和opera.请检查 http://www.electrictoolbox.com/style-select-optgroup-options-css/

                  italic is not apply in chrome and opera. plz check http://www.electrictoolbox.com/style-select-optgroup-options-css/

                  我们可以为选项提供任何设计.

                  we can give any design for options.

                  <select name="name" id="id">
                      <option style='font-style: italic; font-weight:bold;' selected="selected" value="#">
                          <span>Choose One</span>
                      </option>
                      <optgroup label="Option group 1">
                          <option value="TestValue">    TestValue</option>
                          <option value="TestValue">    TestValue</option>
                          <option value="TestValue">    TestValue</option>
                      </optgroup>
                  </select>
                  

                  css:

                  select option {
                      background: none repeat scroll 0 0 #E5E3E3;
                      border: 1px dotted #CCCCCC;
                      height: 15px;
                      line-height: 15px;
                      text-indent: 3px;
                      text-transform: capitalize;
                      z-index: -9999; 
                  }
                  optgroup { /* Change font style and text alignment */
                      font-style:italic;
                      text-align:right;
                  }
                  

                  这篇关于特定项目(选项)HTML 中的列表框样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:javascript复选框启用/禁用 下一篇:JS 客户端 Exif 方向:旋转和镜像 JPEG 图像

                  相关文章

                  最新文章

                  <small id='n15pn'></small><noframes id='n15pn'>

                    <bdo id='n15pn'></bdo><ul id='n15pn'></ul>
                • <i id='n15pn'><tr id='n15pn'><dt id='n15pn'><q id='n15pn'><span id='n15pn'><b id='n15pn'><form id='n15pn'><ins id='n15pn'></ins><ul id='n15pn'></ul><sub id='n15pn'></sub></form><legend id='n15pn'></legend><bdo id='n15pn'><pre id='n15pn'><center id='n15pn'></center></pre></bdo></b><th id='n15pn'></th></span></q></dt></tr></i><div id='n15pn'><tfoot id='n15pn'></tfoot><dl id='n15pn'><fieldset id='n15pn'></fieldset></dl></div>

                    1. <tfoot id='n15pn'></tfoot>

                      <legend id='n15pn'><style id='n15pn'><dir id='n15pn'><q id='n15pn'></q></dir></style></legend>