CSS url()函数的示例用法是什么?

前端之家收集整理的这篇文章主要介绍了CSS url()函数的示例用法是什么?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
3.4. Resource Locators: the <url> type描述了< url-modifier>在

A URL is a pointer to a resource and is a functional notation
denoted by <url>. The Syntax of a <url> is:

<url> = url( <string> <url-modifier>* )

In addition to the Syntax defined above,a can sometimes be
written in other ways:

  • For legacy reasons,a <url> can be written without quotation marks around the URL itself. This Syntax is specially-parsed,and
    produces a <url-token> rather than a function syntactically.
    [07001]

  • Some CSS contexts,such as 07002,allow a <url> to be represented by a 07003 instead. This behaves identically to
    writing a url() function containing that string. Because these
    alternate ways of writing a <url> are not functional notations,they
    cannot accept any <url-modifier>s.

Note: The special parsing rules for the legacy quotation mark-less
<url> Syntax means that parentheses,whitespace characters,single
quotes (‘) and double quotes (“) appearing in a URL must be escaped
with a backslash,e.g. url(open\(parens),url(close\)parens).
Depending on the type of URL,it might also be possible to write these
characters as URL-escapes (e.g. url(open%28parens) or
url(close%29parens)) as described in[07004]. (If written as a
normal function containing a string,ordinary string escaping rules
apply; only newlines and the character used to quote the string need
to be escaped.)

07005

The url() function supports specifying additional <url-modifier>s,
which change the meaning or the interpretation of the URL somehow. A
<url-modifier> is either an 07006 or a 07007.

This specification does not define any <url-modifier>s,but other
specs may do so.

参见CSS Values and Units Module Level 3
Editor’s Draft,21 March 2016

>什么是< ident>的示例用法并在url()函数
>< string>之间有什么区别? ,< ident>,在url()中的功能

解决方法

A <url-modifier> is either an <ident> or a function.

< ident>是一个标识符。

A portion of the CSS source that has the same Syntax as an <ident-token>.

<ident-token> Syntax ;

我找不到任何< ident>的例子在url函数中使用但是
this email所述,有一些可能的未来用途。

>提取选项来控制CORS / cookies / etc
>使用子资源完整性

查看< ident>语法你不能使用键/值对,所以我假设
其中大部分将使用尚不存在的功能实现,资源提示可以使用< ident&gt ;.实现。 .foo {
background-image:url(“// aa.com/img.svg”prefetch);
}}

然而,我找到了一个“有趣的想法的集合”,其功能是< url-modifier>定义。

SVG Parameters(不是官方规格)

params()功能是< url-modifier>

.foo {background-image:url(“// aa.com/img.svg”param( – color var( – primary-color)));}}

猜你在找的CSS相关文章