Style attributes dropped with parentheses in image url

That is not an Elm issue - your code is just invalid CSS.

You can fix that either by

  • quoting URL: url("image(1).jpg")
  • escaping parentheses with \: url(image\(1\).jpg)
  • or using %-encoding as you said

From CSS2 - 4.3.4 URLs and URIs:

Some characters appearing in an unquoted URI, such as parentheses, white space characters, single quotes (') and double quotes ("), must be escaped with a backslash so that the resulting URI value is a URI token: ‘(’, ‘)’.

Depending on the type of URI, it might also be possible to write the above characters as URI-escapes (where “(” = %28, “)” = %29, etc.) as described in [RFC3986].

1 Like