2014-09-23 104 views
2

我正在向網站添加各種物理方程。我需要添加幾個特殊字符,並且我還沒有找到其中的一些特殊字符(例如,我需要添加一個捲曲的「E」來表示能量密度,並且我需要添加一個H頂部的'^'符號表示哈密爾頓算子)。因此,我想知道是否有人編譯了一個包含所有各種HTML特殊字符的表(例如h-bar的ħ,等於h/2PI)。如果是這樣,一個鏈接將不勝感激!謝謝!我在哪裏可以找到所有特殊HTML字符的列表?

+0

你可以改寫像這樣的問題:我如何在網站上顯示物理方程?我曾嘗試在下列實例中使用HTML特殊字符,但我無法找到所需的全部列表。 – 2014-09-23 03:02:17

+0

你也可以嘗試MathJax:http://www.mathjax.org/ – 2014-09-23 03:03:15

+0

DuckDuckGo提供了一個相當廣泛的html實體列表:[在DuckDuckGo的html實體](https://duckduckgo.com/?q=html+實體) – blade19899 2015-01-07 12:48:44

回答

3

只需一點點的Javascript你可以建立自己的:

Unicode UTF-8 characters generator

function el(id) {return document.getElementById(id); } 

var from = 8000; // Start from 
var show = 1000; // How many to show 
var cont = el("container"); 
var prev = el("prev"); 
var next = el("next"); 
var curr = el("curr"); 


function prevNext(){ 
    from = this.id === "next" ? from+=show : from-=show; 
    if(from>=0)createUnicodeChars(); 
    else from=0; 
} 

function createUnicodeChars() { 
    var spans = ""; 
    for(var i=from; i<from+show; i++){ 
    var uc = i.toString(16); 
    spans += "<span>&#"+i+";<br><small>&amp;#"+i+";<br>\\"+uc+"</small></span>"; 
    } 

    curr.innerHTML = from +' - '+ (from+show); 
    cont.innerHTML = spans; 
} 

prev.onclick = prevNext; 
next.onclick = prevNext; 

createUnicodeChars(); // First run! 
body{background:#eee;} 
span{ 
    position:relative; 
    display:inline-block; 
    width: 80px; 
    padding:10px; 
    height:80px; 
    margin:3px; 
    font-size:2em; 
    text-align:center; 
    vertical-align:top; 
    background:#fff; 
    border:1px solid #aaa; 
    border-radius:5px; 
    box-shadow: 0 2px 3px rgba(0,0,0,0.1); 
} 
span small{ 
    position:absolute; 
    width:80%; 
    bottom:5px; 
    text-align:ccenter; 
    display:block; 
    font-size:12px; 
    line-height:14px; 
} 
#container{ 
    margin-top:50px; 
    text-align:center; 
} 
#controls{ 
    background:#fff; 
    box-shadow: 0 0 20px #000; 
    position:fixed; 
    z-index:1; 
    top:0; 
    left:0; 
    padding:10px; 
    width:100%; 
    text-align:center; 
} 
<div id="controls"> 
     <button id="prev">PREV</button> 
     <b id="curr"></b> 
     <button id="next">NEXT</button> 
</div> 
<div id="container"></div> 

會給你字符表示
數值HTML編碼&#num;的Unicode字符,
UTF-8十六進制。代碼\hex(你可以在CSS :after:before內容使用:jsBin

相關問題