Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

204
Visualizações
How to add space after "," in a string using CSS/Sass

I have a table cell and it has a string in it. I need to give space provide a single space after comma using only CSS/scss. It should look like this. expected

Currently it looks like below image

actual

This 3,500 GE text is in a span tag and I also need to change the position of text inside the span tag as shown in first tag.

All I can find solution using JS, but I want through only CSS/SCSS.

.amountCount {
  text-align: center;
  position: relative;
}
<span class="amountCount">3,500 GE</span>

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

First of all, CSS isn't suitable for that operation since CSS is in charge of styling, not modifying the actual contents that exist in the DOM.

In any case, if you really need to do it with CSS and you can divide the HTML content in two, you could insert new elements with custom contents using CSS and kind of reach your goal.

.amountCount span:not(:last-child):after{
  content: ", ";
}
<span class="amountCount">
  <span>3</span>
  <span>500 GE</span>
</span>

about 4 years ago · Juan Pablo Isaza Relatório

0

There is an (admittedly imperfect) HTML-only solution, which is to use a full-width comma:

&#65292;

Working Example:

table,
td {
  border: 1px solid rgb(0, 0, 0);
}

td {
  padding: 6px 12px;
}
<table>
  <tr>
    <td><span class="amountCount">3,500 GE</span></td>
    <td><span class="amountCount">3&#65292;500 GE</span></td>
  </tr>
</table>

N.B. I recognise this is imperfect since you want the whitespace to display only on the right-hand side of the comma character, not on both sides.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda