Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

185
Views
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 answers
Answer question

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!