Reputation: 504
I'm trying to split the following CSS rule into two lines:
background: url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7") 0 0 repeat;
I tried splitting the url base64 string into two sub strings to avoid going over the line length according to the style guide for an open source project called PDF.js.
I tried doing "xxxx" + "xxxx" and that didn't work.
So I was wondering if anyone has tried to do that before or if it is even possible to concat two strings in a css rule?
Upvotes: 3
Views: 293
Reputation: 504
According to the CSS2 specification http://www.w3.org/TR/2011/REC-CSS2-20110607/syndata.html#strings, there is no concat operation. However, you can split strings on multiple lines for aesthetic reasons.
It is possible to break strings over several lines, for aesthetic or other reasons, but in such a case the newline itself has to be escaped with a backslash ().
So the solution to my problem would be:
background: url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAA\
LAAAAAABAAEAAAIBRAA7") 0 0 repeat;
Which is kind of related to this question
Upvotes: 1