<tfoot id='BQC2D'></tfoot>
      • <bdo id='BQC2D'></bdo><ul id='BQC2D'></ul>
      <legend id='BQC2D'><style id='BQC2D'><dir id='BQC2D'><q id='BQC2D'></q></dir></style></legend>

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

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

        放&lt;span/&gt;不好吗?&lt;option/&gt; 中的标签标签,仅用于

        时间:2023-07-31
        <tfoot id='RFynr'></tfoot>

          <tbody id='RFynr'></tbody>
        <legend id='RFynr'><style id='RFynr'><dir id='RFynr'><q id='RFynr'></q></dir></style></legend>

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

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

                1. 本文介绍了放&lt;span/&gt;不好吗?&lt;option/&gt; 中的标签标签,仅用于字符串操作而不是样式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我想将 <option/> 标记的文本内容分组.假设我有以下:<option>8:00(1小时)</option>,时间模式8:00可以修改,然后文字括号内的(1小时)也可以修改.

                  I would like to make groups of the text content of an <option /> tag. Say I have the following: <option>8:00 (1 hour)</option>, the time pattern 8:00 can be modified, then the text in parenthesis (1 hour) can also be modified.

                  我正在考虑做类似的事情

                  I was thinking of doing something like

                  <option>
                    <span>8:00</span>
                    <span> (1 hour)</span>
                  </option>
                  

                  <span/> 标签放在 <option/> 标签内是不是很糟糕,只用于字符串操作而不是样式?

                  Is it bad to put <span /> tags inside <option /> tags, only for string manipulation not styling?

                  推荐答案

                  来自 HTML 5 规范:

                  内容模型:

                  • 如果元素有标签属性和值属性:Nothing.
                  • 如果元素有标签属性但没有值属性:文本.
                  • 如果元素没有标签属性并且不是 datalist 元素的子元素:不是元素间空白的文本.
                  • 如果元素没有标签属性并且是 datalist 元素的子元素:文本.

                  因此,根据上下文,您可以在 <option> 中放入两件事 - 文本或根本不放入 - 您可能不会放入 <span> 或那里的任何其他元素.

                  So depending on context there are two things that you can put inside an <option> — text or nothing at all — you may not put a <span> or any other element there.

                  来自 HTML 4.01 规范:

                  From the HTML 4.01 spec:

                  <!ELEMENT OPTION - O (#PCDATA)         -- selectable choice -->
                  

                  (甚至 HTML 3.2 和 HTML 2 规范都说:<!ELEMENT OPTION - O (#PCDATA)*>)

                  (Even the HTML 3.2 and HTML 2 specs say: <!ELEMENT OPTION - O (#PCDATA)*>)

                  选项元素不能有任何子元素.所以是的,这很糟糕.

                  An option element cannot have any child elements. So yes, it is bad.

                  这篇关于放&lt;span/&gt;不好吗?&lt;option/&gt; 中的标签标签,仅用于字符串操作而不是样式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:HTML 中的全文搜索忽略标签/&amp; 下一篇:关闭 HTML &lt;输入&gt;标签问题

                  相关文章

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

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

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

                    1. <legend id='WdLtq'><style id='WdLtq'><dir id='WdLtq'><q id='WdLtq'></q></dir></style></legend>