diff -u b/core/modules/image/image.module b/core/modules/image/image.module --- b/core/modules/image/image.module +++ b/core/modules/image/image.module @@ -287,7 +287,7 @@ '#height' => $dimensions['height'], '#attributes' => $variables['attributes'], '#uri' => $style->buildUrl($variables['uri']), - '#style_name' => drupal_html_class($variables['style_name']), + '#style_name' => $variables['style_name'], ); if (isset($variables['alt']) || array_key_exists('alt', $variables)) { diff -u b/core/modules/system/templates/image.html.twig b/core/modules/system/templates/image.html.twig --- b/core/modules/system/templates/image.html.twig +++ b/core/modules/system/templates/image.html.twig @@ -14,7 +14,7 @@ #} {% set classes = [ - style_name ? 'image-style-' ~ style_name, + style_name ? 'image-style-' ~ style_name|clean_class, ] %}