可选< optgroup>在HTML< select>标签

编程入门 行业动态 更新时间:2024-10-26 23:35:41
本文介绍了可选< optgroup>在HTML< select>标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

有没有办法让选项组可选?

< select> < optgroup value =0label =父标记> < option value =1>子标签< / option> < option value =2>子标签< / option> < / optgroup> < / select>

解决方案

我不认为你可以,但你可以轻松使用css重现视觉风格,因此只在选择中有选择,所以一切都是可选择的。

.optionGroup {font-weight:bold; font-style:italic;} .optionChild {padding-left:15px;}

< select multiple =multiple> < option value =0class =optionGroup>父标签< / option> < option value =1class =optionChild> Child Tag< / option> < option value =2class =optionChild>儿童标记< / option>< / select>

p>

多重属性允许您选择多行(使用Ctrl单击)。如果它不是你想要的,你可以删除它。这是为了告诉你,一切都变得可选,并且看起来与optiongroup元素一样。

Is there any way to make the option group selectable?

<select> <optgroup value="0" label="Parent Tag"> <option value="1">Child Tag</option> <option value="2">Child Tag</option> </optgroup> </select>

解决方案

I don't think you can but you can easily reproduce the visual style with css and thus only have options in your select, so everything is selectable.

.optionGroup { font-weight: bold; font-style: italic; } .optionChild { padding-left: 15px; }

<select multiple="multiple"> <option value="0" class="optionGroup">Parent Tag</option> <option value="1" class="optionChild">Child Tag</option> <option value="2" class="optionChild">Child Tag</option> </select>

The multiple attribute allow you to select more than one row (with ctrl click). You can remove it if it is not what you want. It was to show you that everything became selectable and that is looking the same as with optiongroup element.

更多推荐

可选&lt; optgroup&gt;在HTML&lt; select&gt;标签

本文发布于:2023-10-31 01:56:28,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1544646.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:可选   标签   lt   amp   optgroup

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!