我们可以在选项元素中添加类属性吗?

编程入门 行业动态 更新时间:2024-10-27 23:26:48
本文介绍了我们可以在选项元素中添加类属性吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想为我的选项元素添加类。

I want to add class for my option element. Is that valid to add class attribute in HTML option element?

推荐答案

是的,它是有效的。

来自 W3School 网站:

The <option> tag also supports the Global Attributes in HTML.

从中类属性是一个零件的。请注意,通常,选项标记具有关于您正在使用的浏览器的格式问题,因此样式可能有点棘手。

From which the class attribute is a part of. Please note that often, the option tag has formatting issues regarding the browser you are using, so styling it can be a little tricky.

编辑:由于我写了这个答案,它引起了我的注意, W3Schools可能不是最可靠的 信息来源。以前的答案并非完全错误,但它来自一个证明有些不一致/不完整的来源。因此,我想我还应该在这个主题上添加更多官方链接这里。

Since I wrote this answer, it has come to my attention that W3Schools probably isn't the most reliable source of good information. The previous answer isn't at all wrong, but it came from a source that has proven to be somewhat inconsistent/incomplete. As such, I think I should also append a more official link to this subject here.

更多推荐

我们可以在选项元素中添加类属性吗?

本文发布于:2023-11-12 00:45:04,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1580027.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:我们可以   选项   元素   类属

发布评论

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

>www.elefans.com

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