如何在css中仅对文本的一部分进行样式设置 [英] how to style only a part of text in css
问题描述
我需要在下拉列表选项中添加上标.我尝试了很多方法,但没有解决.因此,请帮助我如何仅对选项文本的一部分进行样式设置,使其看起来像上标.如果您知道在下拉列表选项中添加上标的任何其他方法,也请帮助我.谢谢
I need to add superscript in dropdownlist options. I tried many ways but nothing worked out. So help me to how to style a only a part of option text to make it appear like superscript. please help me,also if you know any other way to add superscript in dropdownlist options. thanks
推荐答案
在HTML/CSS/Javascript中没有办法
There is no way to do this in HTML/CSS/Javascript
但是,对于所有尝试从< select>
标记中执行此操作的人,请将要上标的内容包装在< span>
元素中,然后将CSS应用于它.
However for all those trying to do it out of a <select>
tag, wrap the content you intend to superscript in a <span>
element and then apply CSS to it.
示例
HTML
<p>x<span class="superscript">2</span> = 9</p>
CSS
span.superscript { vertical-align: super; font-size:50%; }
这篇关于如何在css中仅对文本的一部分进行样式设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!