如何将 STAR 符号放入 html 页面的标题中?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10426381/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 00:07:18  来源:igfitidea点击:

How to put the STAR symbol into title of html page?

htmlspecial-characterstitle

提问by AJ OP

I saw several sites have the star (some solid black, some white star) in their title tab. Anybody know how to do this?

我看到几个网站的标题选项卡中有星号(有些是纯黑色,有些是白色星)。有人知道怎么做吗?

回答by Jukka K. Korpela

You can use various star symbols (there are many of them Unicode) either as such or as an entity reference inside a titleelement, e.g.

您可以使用各种星号(其中有很多是 Unicode),或者作为title元素内的实体引用,例如

<title>☆ Hello world</title>

(if the character encoding of the document is UTF-8 and has been properly declared) or, equivalently,

(如果文档的字符编码是 UTF-8 并且已正确声明)或等效地,

<title>&#x2606; Hello world</title>

However, the titleelement is rendered by browsers in special ways, normally using a font that depends on the operating system or on the browser, beyond author control. This means that the character reperttheitroade can be rather limited in practice.

但是,title元素由浏览器以特殊方式呈现,通常使用依赖于操作系统或浏览器的字体,不受作者控制。这意味着字符库在实践中可能相当有限。

回答by Codrin Eugeniu

You mean this element? ★

你是说这个元素?★

In your html: &#9733;, or in js: \u2605

在您的 html: &#9733;或 js 中:\u2605

More info here: http://www.fileformat.info/info/unicode/char/2605/index.htm

更多信息在这里:http: //www.fileformat.info/info/unicode/char/2605/index.htm

回答by ChristopheD

You do know that you could have a look at the source of the web page to see how others are doing it?

您确实知道可以查看网页的来源以了解其他人是如何做的吗?

But basically you want to insert the right html entityin your title tag, e.g.

但基本上你想在你的标题标签中插入正确的html 实体,例如

<title>&#10021; test symbol</title>