将&lt; span /&gt;放入<span>不好。 &lt; option /&gt;标签,仅用于字符串操作而不是样式? [英] It is bad to put &lt;span /&gt; tags inside &lt;option /&gt; tags, only for string manipulation not styling?

查看:70
本文介绍了将&lt; span /&gt;放入<span>不好。 &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 /> 标记中的$ c>标记,仅用于字符串操作而不是样式化?

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

推荐答案

从HTML 4.01规范:

From the HTML 4.01 spec:

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

来自HTML 5草稿规范:

From the HTML 5 draft spec:


内容模型:
文本。

Content model: Text.



(即使是HTML 3.2和HTML 2规范:<!ELEMENT OPTION - O(#PCDATA)*>

一个选项元素不能有任何子元素。所以是的,这是不好的。

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

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

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆