htmlcsswhitespaceremoving-whitespace

How to remove   from the end of spans with a given class?


I need to remove the   after the value of given spans.
The HTML looks like this:

<span class="number">0.15&nbsp;</span>

The &nbsp; is coming from the server (CMS).

Is there any way to remove the &nbsp; by using CSS rules?


Solution

  • If this value is provided by your CMS, it's posible you can modify the value with php via str_replace('&nbsp;', '', $yourVar) before echo it in your span.

    If you can't access with this, you can also use jQuery to do this... Just like Muhammad Ali said:

    var str = $('.number').html();
    str = str.replace('&nbsp;', '');
    $('.number').html(str);
    

    Something like this could work. But with CSS, isn't posible I guess.