是否有其他空白代码,如 表示半空格、em 空格、en 空格等在 HTML 中有用?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8515365/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Are there other whitespace codes like   for half-spaces, em-spaces, en-spaces etc useful in HTML?
提问by wide_eyed_pupil
Wondering if there are other codes available to use in an HTML newsletter.
想知道是否还有其他代码可用于 HTML 时事通讯。
I would use cell padding or margins but I'm new to this HTML/CSS thing and I can't find a change that does effect both the Main Title line and the sub-head under it. Being an email I'm hesitant to go mucking around with the CSS to get it just so — since I don't know what email clients don't like in the way of CSS as opposed to inline markup.
我会使用单元格填充或边距,但我对这个 HTML/CSS 东西很陌生,我找不到影响主标题行和它下面的子标题的更改。作为电子邮件,我很犹豫要不要使用 CSS 来获得它——因为我不知道电子邮件客户端不喜欢 CSS 而不喜欢内联标记的方式。
For context the template I'm using is Mute theme from Mailchimp snip:
对于上下文,我使用的模板是 Mailchimp 剪辑中的静音主题:
<!-- language: lang-html -->
<table cellspacing="0" cellpadding="0" border="0" align="center" width="626">
<tbody>
<tr>
<td valign="middle" bgcolor="#546781" height="97" background="images/header-bg.jpg" style="vertical-align: middle;">
<table cellspacing="0" cellpadding="0" border="0" align="center" width="555" height="97">
<tbody>
<tr>
<td valign="middle" width="160" style="vertical-align:middle; text-align: left;">
<img width="70" height="70" src="http://dl.dropbox.com/…….png" style="margin:0; margin-top: 4px; display: block;" alt="" />
</td>
<td valign="middle" style="vertical-align: middle; text-align: left;">
<h1 class="title" style="margin:0; padding:0; font-size:30px; font-weight: normal; color: #192c45 !important;">
<singleline label="Title"><span>Title of Report</span></singleline>
</h1>
<h1 class="title" style="margin:0; padding:0; font-size:15px; font-weight: normal; color: #192c45 !important;">
<singleline label="Title"><span>Small Subhead</span></singleline>
</h1>
</td>
<td width="55" valign="middle" style="vertical-align:middle; text-align: center;">
<h2 class="date" style="margin:0; padding:0; font-size:13px; font-weight: normal; color: #192c45 !important; text-transform: uppercase; font-weight: bold; line-height:1;">
<currentmonthname />December
</h2>
<h2 class="date" style="margin:0; padding:0; font-size:23px; font-weight: normal; color: #192c45 !important; font-weight: bold;">
<currentyear />2011
</h2>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
The whole email as a web page can be seen here
可以在此处查看作为网页的整个电子邮件
回答by bookcasey
Yes, many.
是的,很多。
Including, but not limited to:
包括但不仅限于:
- non breaking space :
 
or
- narrow no-break space :
 
(no character reference available) - en space :
 
or 
- em space :
 
or 
- 3-per-em space :
 
or 
- 4-per-em space :
 
or 
- 6-per-em space :
 
(no character reference available) - figure space :
 
or 
? - punctuation space :
 
?or 
? - thin space :
 
?or 
- hair space :
 
?or 
- 非中断空间:
 
或
- 狭窄的不间断空间:(
 
没有可用的字符参考) - 空格 :
 
或 
- em 空间 :
 
或 
- 3-per-em 空间:
 
或 
- 4-per-em 空间:
 
或 
- 每 6 个空格:(
 
没有可用的字符参考) - 图空间:
 
或 
? - 标点符号空间:
 
?或 
? - 薄空间:
 
? 或 
- 头发空间 :
 
? 或 
span{background-color: red;}
<table>
<tr><td>non breaking space:</td><td> <span> </span> or <span> </span></td></tr>
<tr><td>narrow no-break space:</td><td> <span> </span></td></tr>
<tr><td>en space:</td><td> <span> </span> or <span> </span></td></tr>
<tr><td>em space:</td><td> <span> </span> or <span> </span></td></tr>
<tr><td>3-per-em space:</td><td> <span> </span> or <span> </span></td></tr>
<tr><td>4-per-em space:</td><td> <span> </span> or <span> </span></td></tr>
<tr><td>6-per-em space:</td><td> <span> </span></td></tr>
<tr><td>figure space:</td><td> <span> </span> or <span> </span></td></tr>
<tr><td>punctuation space:</td><td> <span> </span>?or <span> </td></tr>
<tr><td>thin space:</td><td> <span> </span>?or <span> </span></td></tr>
<tr><td>hair space:</td><td> <span> </span>?or <span> </span></td></tr>
</table>
回答by Jukka K. Korpela
There are codes for other space characters, and the codes as such work well, but the characters themselves are legacy character. They have been included into character sets only due to their presence in existing character data, rather than for use in new documents. For some combinations of font and browser version, they may cause a generic glyph of unrepresentable character to be shown. For details, check my page about Unicode spaces.
还有其他空格字符的代码,这样的代码运行良好,但字符本身是遗留字符。它们被包含在字符集中只是因为它们存在于现有字符数据中,而不是用于新文档。对于字体和浏览器版本的某些组合,它们可能会导致显示无法表示的字符的通用字形。有关详细信息,请查看我的关于 Unicode 空间的页面。
So using CSS is safer and lets you specify any desired amount of spacing, not just the specific widths of fixed-width spaces. If you just want to have added spacing around your h2 elements, as it seems to me, then setting padding on those elements (changing the value of the padding: 0 settings that you already have) should work fine.
因此,使用 CSS 更安全,并允许您指定任何所需的间距量,而不仅仅是固定宽度空间的特定宽度。如果您只是想在 h2 元素周围添加间距,在我看来,那么在这些元素上设置填充(更改填充的值:您已经拥有的 0 设置)应该可以正常工作。
回答by isNaN1247
Not sure if this is what you're referring to, but this is the list of HTML entities you can use:
不确定这是否是您所指的内容,但这是您可以使用的 HTML 实体列表:
List of XML and HTML character entity references
Using the content within the 'Name' column you can just wrap these in an &
and ;
使用“名称”列中的内容,您可以将它们包装在一个&
和;
E.g.
,  
, etc.
例如
, 
等等。
回答by Ali Nassajpour
I used this Unicode Decimal Code ‌
and worked. more details
我使用了这个 Unicode 十进制代码‌
并工作了。更多细节
回答by HelpNeeder
What about normal encoded white-space character?
普通编码的空白字符怎么样?