本文介紹了CSS:在對內容中的字符進行編碼之后的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
我正在使用以下 CSS,它似乎可以正常工作:
I am using the following CSS, which seems to be working:
a.up:after{content: " ↓";}
a.down:after{content: " ↑";}
然而,這些字符似乎不能像這樣編碼,因為輸出是文字并顯示了實際的字符串:
The characters however cannot seem to be encoded like this, as the output is literal and shows the actual string:
a.up:after{content: " ↓";}
a.down:after{content: " ↑";}
如果我不能對其進行編碼,我覺得我應該在 jQuery 中使用諸如 .append() 之類的東西,因為它支持編碼.有什么想法嗎?
If I can't encode it, it feels like I should use something such as .append() in jQuery, as that supports the encoding. Any ideas?
推薦答案
要在 content
中使用編碼的 Unicode 字符,您需要提供字符本身(如您所做的那樣)或它們的 UTF-8轉義序列而不是 HTML 實體:
To use encoded Unicode characters in content
you need to provide either the characters themselves (as you do), or their UTF-8 escape sequences instead of HTML entities:
a.up:after { content: " 2193"; }
a.down:after { content: " 2191"; }
這篇關于CSS:在對內容中的字符進行編碼之后的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!