diff --git a/addons/web_editor/static/src/js/common/utils.js b/addons/web_editor/static/src/js/common/utils.js
index 621af93829c58c3f0f4a19352528c91e3359debd..6600abc6aaad086db813a77d30f43a46a0770b17 100644
--- a/addons/web_editor/static/src/js/common/utils.js
+++ b/addons/web_editor/static/src/js/common/utils.js
@@ -103,11 +103,11 @@ function _convertNumericToUnit(value, unitFrom, unitTo, cssProp, $target) {
  * @returns {Array|null}
  */
 function _getNumericAndUnit(value) {
-    const m = value.trim().match(/^(-?[0-9.]+)(\w*)$/);
+    const m = value.trim().match(/^(-?[0-9.]+)([A-Za-z% -]*)$/);
     if (!m) {
         return null;
     }
-    return [m[1], m[2]];
+    return [m[1].trim(), m[2].trim()];
 }
 /**
  * Checks if two css values are equal.