本文介绍了我应该怎么写上标文字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序,其中包含大量上标的数字或字母.我注意到

I have an app which contains plenty of figures or letters in superscript. I noticed that

 X<span style="vertical-align: super;">3</span>

并仅在图3周围使用sup标记在我的应用中均产生X.

and just using sup tag around the figure 3 both yield X in my app.

但是只有sup标签在SO上产生X.这是否意味着我应该坚持使用后者?优点和缺点(如果有)有什么区别?

But only the sup tag yields X on SO. Does it mean I should stick with the latter? What are the differences, pros and cons, if any?

我已经检查了 http://www.w3schools.com/tags/tag_sup.asp http://www.w3.org/TR/html- markup/sup.html .我似乎看不到任何差异.

I have checked http://www.w3schools.com/tags/tag_sup.asp and http://www.w3.org/TR/html-markup/sup.html . I don't seem to see any differences.

推荐答案

只需使用<sup>super</sup>

正如您在W3C的参考资料中所看到的那样,sup标签只是CSS的一个例程:

As you have seen in the reference from W3C the sup tag is just a routine for the CSS:

sup {
    vertical-align: super;
    font-size: smaller;
} 

优点:它适用于所有平台,这就是它的目标.还为屏幕阅读器和其他机器人"提供了语义含义.

Pros: It works across all platforms and this is what it's intended for. Also provides semantic meaning to screen readers and other 'bots.

缺点:有些人只是喜欢自己用CSS来做.

Cons: Some people just love to do it themselves in CSS.

充分感谢j08691-对于这个非常简洁的评论:

And full credit to j08691 - for this very succinct comment:

这篇关于我应该怎么写上标文字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-15 21:02