File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -311,6 +311,24 @@ Custom Property Value Syntax</h3>
311311 which user agents can take advantage of by "canonicalizing" them into a single casing,
312312 but that isn't allowed for custom properties.)
313313
314+ <div class=note>
315+ Because custom properties can contain <em> anything</em> ,
316+ there is no general way to know how to interpret what's inside of them
317+ (until they're substituted into a known property with ''var()'' ).
318+ Rather than have them <em> partially</em> resolve in some cases but not others,
319+ they're left completely unresolved;
320+ they're a bare stream of [[css-syntax#tokenization|CSS tokens]] interspersed with ''var()'' functions.
321+
322+ This has some knock-on implications.
323+ For example, relative URLs in CSS
324+ are resolved against the base URL of the stylesheet the value appears in.
325+ However, if a custom property like ''--my-image: url(foo.jpg);'' shows up in an <code> "/a/style.css"</code> stylesheet,
326+ it will not resolve into an absolute URL immediately;
327+ if that variable is later used in a <em> different</em> <code> "/b/style.css"</code> stylesheet
328+ like ''background: var(--my-image);'' ,
329+ it will resolve <em> at that point</em> to <code> "/b/foo.jpg"</code> .
330+ </div>
331+
314332<h3 id='guaranteed-invalid'>
315333Guaranteed-Invalid Values</h3>
316334
You can’t perform that action at this time.
0 commit comments