Isaiah Isaiah - 1 year ago 186
CSS Question

HTML Character - Invisible space

I have a website called DaltonEmpire.

When a user copies "DaltonEmpire" I would like "Dalton Empire" to be added to their clipboard.

I only came to one solution; use a space, but make the

Isn't there a neater solution, such as a HTML character for this?

My example JSFiddle and code:

<li>Dalton<span class="nospace"> </span><b>Empire</b> <i>The only one that works</i>

span.nospace {
letter-spacing: -18px;

Answer Source

You can use word-spacing for this. However to make a more dynamic property you want to use the em unit. This way the unit is based on the font-size, so actually supports all the font families and font sizes:

ol li
    word-spacing: -.2em;

em is not an absolute unit - it is a unit that is relative to the currently chosen font size.

source: Why em instead of px?


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download