<div> and <select> tags

元气小坏坏 提交于 2019-11-29 15:47:34

From the specification:

<!ELEMENT SELECT - - (OPTGROUP|OPTION)+ -- option selector -->

i.e. There is an element called "SELECT", the start tag is required, the end tag is required. It's children can be OPTGROUP elements and/or OPTION elements and there must be at least one of them.

Since a DIV is not an OPTGROUP or an OPTION, the answer is no.

No. Nope. Niet.

No. And there is no reason to.

No, but you may be interested in the optgroup element. Be aware that its appearance tends to vary a lot across different browsers before you start building designs around it though.

While you can generate any crazy HTML you want, that is not a recommended use of DIV. What is the problem you are trying to solve by introducing the DIV?

Perhaps you are unaware of the OPTGROUP tag?

The tag is used to group together related options in a select list.

If you have a long list of options, groups of related options are easier to handle for the user.

I can't see any need to do so. Are you trying to change the appearance one option in the list element?

As everyone has stated there would be no need to do a div within a select list. if you need to individually move list elements in a form id suggest using radio buttons.

as far as i understand, you can only have "option" elements within a "select" element.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!