如何删除& nbsp;从跨度的结束与给定类? [英] How to remove   from the end of spans with a given class?

查看:114
本文介绍了如何删除& nbsp;从跨度的结束与给定类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在给定范围的值之后删除& nbsp;

HTML如下所示:

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

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


来自服务器(CMS)。

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

有任何方法删除& nbsp;通过使用CSS规则?

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

推荐答案

如果这个值是由CMS提供的,你可以通过php通过 str_replace('& nbsp;','',$ yourVar)

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.

如果你不能访问这个,你也可以使用jQuery来做到这一点...就像Muhammad Ali所说:

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.replace('&nbsp;', '');
$('.number').html(str);

这样的东西可以工作。但是用CSS,是不可能的,我猜。

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

这篇关于如何删除&amp; nbsp;从跨度的结束与给定类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆