簡體   English   中英

HTML中的多個空格

[英]Multiple white space in html

我想確保單詞上方的和弦被多個空格很好地分隔開。

問題是,當我使用pre ,它是預先格式化的,因此不是我想要的。

另外,   ,代碼看起來非常難看。

解決此問題的最佳方法是什么?

<pre>Chorus: Em AA common love for each other F#m Bm A common gift to the Saviour </pre> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Em &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;A &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; D &nbsp; &nbsp; D7 A common bond holding us to the Lord

這是URL的鏈接: http : //teach.sg/blog/a-common-love/

在此處輸入圖片說明

有一些空格字符,例如&emsp; 將很有用。 您可以使用&#09; 標簽。 您也可以為此使用CSS。

我有一個替代解決方案,請查看它是否適合您的目的:

我將所有和弦嵌套在<span class = 'chord'>元素中,然后使用CSS樣式規則將和弦向上和向左移動一點。 這種方法有一些丑陋的空格,但是它比垃圾郵件的空格字符更簡潔,更優雅。

 .chord { position: relative; font-size: 0.8em; bottom: 1.5em; right: 2em; width: 0.5em; } p { line-height: 2em; } 
 <body> <p>A common love <span class='chord'>Em</span> for each other <span class='chord'>A</span> </p> <p>A common gift <span class='chord'>F#m</span> to the Saviour <span class='chord'>Bm</span> </p> <p>A common bond <span class='chord'>Em</span> holding us <span class='chord'>A</span> to the Lord <span class='chord'>D-D7</span> </p> </body> 

JSFiddle在這里

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM