Are there other whitespace codes like   for half-spaces, em-spaces, en-spaces etc useful in HTML?

后端 未结 5 1772
暖寄归人
暖寄归人 2020-11-29 15:26

Wondering if there are other codes available to use in an HTML newsletter.

I would use cell padding or margins but I\'m new to this HTML/CSS thing and I can\'t find

相关标签:
5条回答
  • 2020-11-29 15:37

    Not sure if this is what you're referring to, but this is the list of HTML entities you can use:

    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.

    0 讨论(0)
  • 2020-11-29 15:37

    What about normal encoded white-space character?

     
    
    0 讨论(0)
  • 2020-11-29 15:39

    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  

    span{background-color: red;}
    <table>
    <tr><td>non breaking space:</td><td> <span>&#160;</span> or <span>&nbsp;</span></td></tr>
    <tr><td>narrow no-break space:</td><td> <span>&#8239;</span></td></tr>
    <tr><td>en space:</td><td> <span>&#8194;</span> or <span>&ensp;</span></td></tr>
    <tr><td>em space:</td><td> <span>&#8195;</span> or <span>&emsp;</span></td></tr>
    <tr><td>3-per-em space:</td><td> <span>&#8196;</span> or <span>&emsp13;</span></td></tr>
    <tr><td>4-per-em space:</td><td> <span>&#8197;</span> or <span>&emsp14;</span></td></tr>
    <tr><td>6-per-em space:</td><td> <span>&#8198;</span></td></tr>
    <tr><td>figure space:</td><td> <span>&#8199;</span> or <span>&numsp;</span></td></tr>
    <tr><td>punctuation space:</td><td> <span>&#8200;</span> or <span>&puncsp;</td></tr>
    <tr><td>thin space:</td><td> <span>&#8201;</span> or <span>&thinsp;</span></td></tr>
    <tr><td>hair space:</td><td> <span>&#8202;</span> or <span>&hairsp;</span></td></tr>
    </table>

    0 讨论(0)
  • 2020-11-29 15:43

    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.

    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.

    0 讨论(0)
  • 2020-11-29 15:54

    I used this Unicode Decimal Code &#8204; and worked. more details

    0 讨论(0)
提交回复
热议问题