AlexG AlexG - 7 months ago 23
HTML Question

Peudo elements: space between characters

I have a badge that adds brackets via CSS. Unfortunatelly it also adds spaces, is there a way to remove the spaces without a negative margin?

Current Output: Items ( 10 )

Desired Output: Items (10)

.badge:before {
content: '(';
}

.badge:after {
content: ')';
}


JSFiddle

Answer

It adds spaces because you've got spaces in your markup. There are no spaces if you do this:

Items
<span class="badge">10</span>
<hr>
Items (10)
Comments