Dan Dan - 1 year ago 118
CSS Question

Add whitepaces with ::before selector

I have tried this but it didn't work:

.stackoverflow::before {
font-family: 'FontAwesome';
content: "\f16c ";

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css">
<a class="stack-link stackoverflow" href="http://stackoverflow.com">StackOverflow</a>

Can we add whitespace(s) with
selector and
property like that?

Answer Source

Yes, You can add whitespace like this content: "\f16c \00a0";


\00a0 is hex code for a non-breaking space,used in content property. More Info

Hope it helps :)

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