假设我有 style.css:
#some_element{
background-image: url('img/picture.gif');
}
css 和 picture.gif 位于这样的结构中:
style.css
other_style.css
more_style.css
img
picture.gif
使用 php,我将 style.css、other_style.css 和 more_style.css 组合到远离原始位置的 cache_style.css 中。
在这种情况下,链接将被破坏。
在 html 中,我们有标签来定义(如其名称)当前文档的基本 url。这样每个链接和每个图像都可以基于该基本 url 获取内容。
css 和 javascript 有什么替代方法可以做到这一点吗?
编辑:一些 css/javascript 是缩小的第三方,几乎不可能将“img/picture.gif”更改为“/something/img/picture.gif”