diff --git a/src/Plugin/Field/FieldFormatter/IconSelectFormatterDefault.php b/src/Plugin/Field/FieldFormatter/IconSelectFormatterDefault.php
index dfa2540..58362cf 100644
--- a/src/Plugin/Field/FieldFormatter/IconSelectFormatterDefault.php
+++ b/src/Plugin/Field/FieldFormatter/IconSelectFormatterDefault.php
@@ -126,8 +126,11 @@ class IconSelectFormatterDefault extends FormatterBase {
       /** @var \Drupal\Core\Template\Attribute $attributes */
       $attributes = new Attribute();
       if ($this->getSetting('apply_dimensions')) {
-        $attributes['width'] = $this->getSetting('width');
-        $attributes['height'] = $this->getSetting('height');
+        foreach (['width', 'height'] as $attribute_key) {
+          if (!empty($attribute_value = $this->getSetting($attribute_key))) {
+            $attributes[$attribute_key] = $attribute_value;
+          }
+        }
       }
 
       // Prepare classes.
