-
Notifications
You must be signed in to change notification settings - Fork 759
Description
Hi, I am trying to understand whether this behavior is due to Apache or the CSS specification itself. Could you clarify if this is intended?
My questions are:
- Why does @Property cause the browser to encode spaces differently than a direct url()?
- Is this behavior specified in CSS Values and Units Level 4, or is it an implementation quirk of browsers?
- Is there a recommended, CSP-safe way to define URLs in @Property without manually encoding spaces?
Thank you in advance for your help!
I defined a CSS custom property to replace directly using a url() in a rule:
@property --ball {
syntax: "<url>";
inherits: false;
initial-value: url('../../images/ajax-loader-big-circle-ball.gif');
}
.modal-backdrop {
background: rgba(255, 255, 255, 0.5) var(--ball) 50% 50% no-repeat;
}I noticed something odd with how the URL gets interpreted by the browser:
When I use the url() directly in the CSS, the request is made to:
http://localhost:8081/images/ajax%20loader%20big%20circle%20ball.gif
When I use the @Property custom property with initial-value, the browser seems to request:
http://localhost:8081/images/ajax-loader-big-circle-ball.gif
To make it work, I had to change the initial-value to:
initial-value: url('../../images/ajax%20loader%20big%20circle%20ball.gif');