Skip to main content

function-url-no-scheme-relative

禁止与方案相关的 url。

¥Disallow scheme-relative urls.

a { background-image: url('//www.google.com/file.jpg'); }
/** ↑

* This scheme-relative url */

方案相对 url 是以 // 开头,后跟主机的 url。

¥A scheme-relative url is a url that begins with // followed by a host.

此规则忽略作为变量($sass@less--custom-property)的 url 参数。

¥This rule ignores url arguments that are variables ($sass, @less, --custom-property).

选项

¥Options

true

以下模式被视为问题:

¥The following patterns are considered problems:

a {
background: url("//www.google.com/file.jpg");
}

以下模式不被视为问题:

¥The following patterns are not considered problems:

a {
background: url("../file.jpg");
}
a {
background: url("http://www.google.com/file.jpg");
}
a {
background: url("/path/to/file.jpg");
}