在CSS中转义URL

时间:2014-03-25 08:58:59

标签: css moodle

我正在moodle(arrg)中设计一个页面,我需要转义网址,因此moodle不会将其识别为网址。 我的代码:

<td style="background-image: url('http://example.com/pluginfile.php/788/mod_forum/intro/header_start.jpg');>

Moodle识别出“链接”,因此用<a>标记

包装
<td style="background-image: url('&lt;a href=" http:="" example.com="" pluginfile.php="" 788="" mod_forum="" intro="" header_start.jpg'"="" class="_blanktarget">http://example.com/pluginfile.php/788/mod_forum/intro/header_start.jpg'); width: 55px; height: 50px;"&gt;

您能想出任何可能的解决方法吗?我想也许是这样的:

url('ht'+'tp://example.com/pluginfile.php/788/mod_forum/intro/header_start.jpg');

但我在css中找不到关于url连接的任何内容。

1 个答案:

答案 0 :(得分:1)

根据documentation,您应该能够禁用自动链接功能,但将该部分包含在不应该出现的地方......,所以在您的情况下:

<nolink>
<td  style="background-image: url('http://example.com/blah.jpg');">
</nolink>

或者,您可以在相关代码上方添加样式块并使用类或ID,假设moodle知道跳过这些元素。

另外,请尝试将标记更改为:

<td  style="background-image: url(http://example.com/blah.jpg);">

双引号内的单引号可能会抛弃任何&#34;跳过检查属性&#34;类型过滤器。并且您的示例代码没有style属性关闭引号,如果不是拼写错误。