Error: End tag for 'optgroup' which is not finished. You have probably failed to
include a required child element. Hence the parent element is "not finished",
not complete.
我想在选择选项中实现类似的目标。
USA
UK
--
Afghanistan
我想把几个重要的国家放在最上面,然后是一个不可选择的分隔符,然后是剩余国家的有序列表。
我使用空的“optgroup”放置此分隔线。虽然它在所有浏览器中都能完美运行,但我收到验证错误。
还有什么其他方法可以实现这一点?
最佳答案
与@ZippyV 写的类似,您可以只使用 <option>
并将其禁用:
<option disabled='disabled'>--</option>
那将是不可选择的。另外,如果是我,我会使用 m-dash 而不是两个连字符:
<option disabled='disabled'>—</option>
关于html - <optgroup label ='-------' ></optgroup> 给出 xhtml 验证错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2401437/