使用HTML< strong>< select>内的标签.是否可以? [英] Using HTML <strong> tags inside <select>. Is it possible?

查看:47
本文介绍了使用HTML< strong>< select>内的标签.是否可以?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在这段代码中使用html标记来造词?

Is it possible make a word using the html tag in this piece of code?

echo "<select>";
echo "<option ><strong><em>carro</em></strong></option >";
echo "<option >car</option >";
echo "<option >apple</option >";
echo "</select>";

推荐答案

不,您不能在 option 元素内使用HTML标记,因为其内容由

No, you cannot use HTML tags inside an option element, since its content is by definition plain text.

这回答了所问的问题.如果要问如何设置 option 元素或其部分的样式,那么在SO上有一些关于此类问题的老问题.造型零件是不可能的.取决于浏览器,使用CSS设置整个 option 元素的样式可能或不可能.

This answers the question asked. If the intent was to ask how to style option elements or their parts, then there are several old questions on such issues at SO. Styling parts is impossible. Styling an entire option element may or may not be possible using CSS, depending on browser.

这篇关于使用HTML&lt; strong&gt;&lt; select&gt;内的标签.是否可以?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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