此 ▲ 的 HTML 字符代码或者这个▼
此向上箭头 (▲
) 及其向下的狗版本 (▼
) 的 HTML 实体字符代码是什么?
我一直使用 GIF 来表示这些箭头,因为我不知道它们的代码。
What are the HTML entity character codes for this up arrow (▲
) and its downward-facing dog version (▼
) ?
I've been using GIFs to represent these arrows since I don't know their codes.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
面向4个方向的大小黑色三角形可以表示为:
▲
▲▴
▴▶< /code> ▶
▸
▸►
►▼
▼▾
▾◀
◀◂
> ◂◄
◄The Big and small black triangles facing the 4 directions can be represented thus:
▲
▲▴
▴▶
▶▸
▸►
►▼
▼▾
▾◀
◀◂
◂◄
◄▲
▼
我通常使用 优秀的 Gucharmap 来查看最多 Unicode 字符。它以“Character Map”的名称安装在所有最近安装的带有 Gnome 的 Linux 上。我不知道有任何适用于 Windows 或 Mac OS X 的等效工具,但其主页列出了一些。
▲
▼
I usually use the excellent Gucharmap to look up Unicode characters. It's installed on all recent Linux installations with Gnome under the name "Character Map". I don't know of any equivalent tools for Windows or Mac OS X, but its homepage lists a few.
有几种正确的方法来显示向下和向上的三角形。
方法 1:使用十进制 HTML 实体
HTML:
方法 2:使用十六进制 HTML 实体
HTML:
方法 3:直接使用字符
HTML:
方法 4:使用 CSS
HTML:
CSS:
这三种方法中的每一种都应具有相同的输出。对于其他符号,存在相同的三个选项。有些甚至还有第四个选项,允许您使用基于字符串的引用(例如
♥
显示 ♥)。您可以使用 Unicode-table.com 等参考网站来查找UNICODE 支持图标以及它们对应的代码。例如,您可以在 http://unicode-table 找到向下三角形的值.com/en/25BC/。
请注意,这些方法仅适用于每个浏览器中默认可用的图标。对于像 ☃、❄、★、☂、☭、⎗ 或 ⎘ 这样的符号,这种情况的可能性要小得多。虽然可以为其他 UNICODE 符号提供跨浏览器支持,但过程有点复杂。
如果您想了解如何添加对不太常见的 UNICODE 字符的支持,请参阅使用 Unicode 补充多语言平面符号创建网络字体,了解有关操作方法的更多信息 这。
背景图像
一种完全不同的策略是使用背景图像而不是字体。为了获得最佳性能,最好通过对图像进行基本编码来将图像嵌入到 CSS 文件中,如例如所述。 @weasel5i2 和@Obsidian。不过,我建议使用 SVG 而不是 GIF,因为这对于性能和符号清晰度来说都更好。
以下代码是 图标的 Base64 和 SVG 版本:
何时使用背景-图像或字体
对于许多用例,基于 SVG 的背景图像和图标字体在性能和灵活性方面基本相同。要决定选择哪个,请考虑以下差异:
SVG 图像
color
、font-size
、line-height、
background-color
或其他与字体相关的样式规则来更改图标的显示,但您可以将图标的不同组件单独引用为形状。图标字体
color
、font-size
、line-height
、background-color
或其他与字体相关的样式规则更改图标的显示个人而言,我建议仅当您需要多种颜色并且这些颜色无法通过以下方式实现时才使用背景图像
颜色
的意思,background-color
和其他与颜色相关的字体 CSS 规则。使用 SVG 图像的主要好处是您可以为符号的不同组件赋予自己的样式。如果将 SVG XML 代码嵌入到 HTML 文档中,这与设置 HTML 样式非常相似。然而,这会导致网页同时使用 HTML 标签和 SVG 标签,这可能会显着降低网页的可读性。如果符号在多个页面中重复,它还会增加额外的膨胀,并且您需要考虑旧版本的 IE 对 SVG 没有或有限的支持。
There are several correct ways to display a down-pointing and upward-pointing triangle.
Method 1 : use decimal HTML entity
HTML :
Method 2 : use hexidecimal HTML entity
HTML :
Method 3 : use character directly
HTML :
Method 4 : use CSS
HTML :
CSS :
Each of these three methods should have the same output. For other symbols, the same three options exist. Some even have a fourth option, allowing you to use a string based reference (eg.
♥
to display ♥).You can use a reference website like Unicode-table.com to find which icons are supported in UNICODE and which codes they correspond with. For example, you find the values for the down-pointing triangle at http://unicode-table.com/en/25BC/.
Note that these methods are sufficient only for icons that are available by default in every browser. For symbols like ☃,❄,★,☂,☭,⎗ or ⎘, this is far less likely to be the case. While it is possible to provide cross-browser support for other UNICODE symbols, the procedure is a bit more complicated.
If you want to know how to add support for less common UNICODE characters, see Create webfont with Unicode Supplementary Multilingual Plane symbols for more info on how to do this.
Background images
A totally different strategy is the use of background-images instead of fonts. For optimal performance, it's best to embed the image in your CSS file by base-encoding it, as mentioned by eg. @weasel5i2 and @Obsidian. I would recommend the use of SVG rather than GIF, however, is that's better both for performance and for the sharpness of your symbols.
This following code is the base64 for and SVG version of the icon :
When to use background-images or fonts
For many use cases, SVG-based background images and icon fonts are largely equivalent with regards to performance and flexibility. To decide which to pick, consider the following differences:
SVG images
color
,font-size
,line-height
,background-color
or other font related styling rules to change the display of your icon, but you can reference different components of the icon as shapes individually.Icon fonts
color
,font-size
,line-height
,background-color
or other font related styling rules to change the display of your iconPersonally, I would recommend the use of background-images only when you need multiple colors and those color can't be achieved by means of
color
,background-color
and other color-related CSS rules for fonts.The main benefit of using SVG images is that you can give different components of a symbol their own styling. If you embed your SVG XML code in the HTML document, this is very similar to styling the HTML. This would, however, result in a web page that uses both HTML tags and SVG tags, which could significantly reduce the readability of a webpage. It also adds extra bloat if the symbol is repeated across multiple pages and you need to consider that old versions of IE have no or limited support for SVG.
您不需要使用字符代码;只需使用 UTF-8 并将它们按字面意思输入即可;像这样:
如果您绝对必须使用实体,它们分别是
▲
和▼
。You don't need to use character codes; just use UTF-8 and put them in literally; like so:
If you absolutely must use the entites, they are
▲
and▼
, respectively.▲
是 Unicode 黑色向上三角形 (▲),而▼
是黑色向下三角形 (▼)。您只需将字符(从网络复制)插入此网站即可进行查找。
▲
is the Unicode black up-pointing triangle (▲) while▼
is the black down-pointing triangle (▼).You can just plug the characters (copied from the web) into this site for a lookup.
检查此页面http://www.alanwood.net/unicode/geometric_shapes.html,第一个是“9650 ▲ 25B2 黑色上指三角形(出现在 WGL4 中)”,第二个是“9660 ▼ 25BC 黑色下指三角形(出现在 WGL4 中)”。
Check this page http://www.alanwood.net/unicode/geometric_shapes.html, first is "9650 ▲ 25B2 BLACK UP-POINTING TRIANGLE (present in WGL4)" and 2nd "9660 ▼ 25BC BLACK DOWN-POINTING TRIANGLE (present in WGL4)".