如何在html文本输入标记中使用上标? [英] How to use superscript in an html text input tag?

查看:753
本文介绍了如何在html文本输入标记中使用上标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的输入标签(我使用Bootstrap),其中我现在要放置一个上标(显示m 2 )。问题是,当我这样做:

I've got a simple input tag (which I prettify using Bootstrap) in which I now want to place a superscript (to display "m2"). The problem is that when I do this:

<input class="form-control" name="gla" placeholder="m<sup>2</sup>" type="text">

占位符字面上显示: m< sup> 2< / sup&

有人知道如何正确显示上标吗?欢迎所有提示!

Does anybody know how I can properly display the superscript? All tips are welcome!

推荐答案

您可以使用UTF-8字符作为上标²。还要确保将文档的字符集设置为 UTF-8

You could just use the UTF-8 character for superscripted ². Also be sure to set the charset of the document to UTF-8.

<html>
    <head>
        <meta charset="UTF-8"> 
    </head>
    <body>
        <input class="form-control" name="gla" placeholder="m²" type="text" />
    </body>
</html>

另外此回答可能有帮助。

这篇关于如何在html文本输入标记中使用上标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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