how to style only a part of text in css [duplicate]

有些话、适合烂在心里 提交于 2021-02-05 06:00:26

问题


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


回答1:


There is no way to do this in HTML/CSS/Javascript

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.

Example

HTML

<p>x<span class="superscript">2</span> = 9</p>

CSS

span.superscript { vertical-align: super; font-size:50%; }

Fiddle demo



来源:https://stackoverflow.com/questions/19519608/how-to-style-only-a-part-of-text-in-css

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