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>@H_502_10@. The Syntax of a <url>@H_502_10@ is:

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

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

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

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

Note: The special parsing rules for the legacy quotation mark-less
<url>@H_502_10@ 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)@H_502_10@,url(close\)parens)@H_502_10@.
Depending on the type of URL,it might also be possible to write these
characters as URL-escapes (e.g. url(open%28parens)@H_502_10@ or
url(close%29parens)@H_502_10@) 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()@H_502_10@ function supports specifying additional <url-modifier>@H_502_10@s,
which change the meaning or the interpretation of the URL somehow. A
<url-modifier>@H_502_10@ is either an 07006 or a 07007.

This specification does not define any <url-modifier>@H_502_10@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>@H_502_10@ is either an <ident>@H_502_10@ or a function@H_502_10@.

< ident>是一个标识符。

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

<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相关文章