Javascript 在旧浏览器中显示表情符号
假设我有一些特殊字符,比如特殊字符,比如“你应该包括一个支持你想要使用的表情符号的webfont 要在CSS中包含图标字体,请使用以下代码:Javascript 在旧浏览器中显示表情符号,javascript,unicode,Javascript,Unicode,假设我有一些特殊字符,比如特殊字符,比如“你应该包括一个支持你想要使用的表情符号的webfont 要在CSS中包含图标字体,请使用以下代码: @font-face { font-family: 'myfont'; src:url('fonts/myfont.eot?-td2xif'); src:url('fonts/myfont.eot?#iefix-td2xif') format('embedded-opentype'), url('fonts/myfo
@font-face {
font-family: 'myfont';
src:url('fonts/myfont.eot?-td2xif');
src:url('fonts/myfont.eot?#iefix-td2xif') format('embedded-opentype'),
url('fonts/myfont.woff?-td2xif') format('woff'),
url('fonts/myfont.ttf?-td2xif') format('truetype'),
url('fonts/myfont.svg?-td2xif#myfont') format('svg');
// Different URLs are required for optimal browser support
// Make sure to :
// 1) replace the URLs with your font's URLs
// 2) replace `#myfont` with the name of your font
font-weight: normal; // To avoid the font inherits boldness
font-style: normal; // To avoid font inherits obliqueness or italic
}
.emoji {
font-family: 'myfont', Verdana, Arial, sans-serif; // Use regular fonts as fallback
speak: none; // To avoid screen readers trying to read the content
font-style: normal; // To avoid font inherits obliqueness or italic
font-weight: normal; // To avoid the font inherits boldness
font-variant: normal; // To avoid the font inherits small-caps
text-transform: none; // To avoid the font inherits capitalization/uppercase/lowercase
line-height: 1; // To avoid the font inherits an undesired line-height
-webkit-font-smoothing: antialiased; // For improved readability on Webkit
-moz-osx-font-smoothing: grayscale; // For improved readability on OSX + Mozilla
}
然后,您可以像这样包含您的符号:
<span class="icon">👍</span>
和#128077;
如果您不知道支持您的角色的webfont,您可以使用轻松创建一个。另请参阅我的开放源码以获取支持表情符号的图标字体示例,该示例是我使用Icomoon应用程序创建的
更多信息:
@font-face
。谢谢你的提示!:)