CssToInlineStyles icon indicating copy to clipboard operation
CssToInlineStyles copied to clipboard

Keeping double properties

Open PreVaDu opened this issue 7 years ago • 1 comments

In my case of use I have to set e.g. text-decoration property twice to make it correct in all target supported mail clients. It means my links have text-decoration: none; text-decoration: none !important;.

Inliner gets logically only last value, it means link in inlineCssOnElement function has $inlineProperties['text-decoration'] = "none !important".

It isn't problem to edit function to keep original styles and only add not included:

...
foreach (/*array_merge(*/$cssProperties/*, $inlineProperties)*/ as $property) {
    $rules[] = $property->toString();
}
$element->setAttribute('style', $element->getAttribute('style').implode(' ', $rules));
...

but which way is optimal for keeping both properties from style tag? Generally I need to add important or non-important version of property if miss in inline.

Has anyone idea?

Thanks in advance!

PreVaDu avatar Feb 23 '17 18:02 PreVaDu

Hi @PreVaDu. Any updates on this? Have you found a solution/alternative?

osbre avatar May 18 '21 08:05 osbre