You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Built-in defaults override HTML attributes, so <hr color> and <hr width> are ignored #531
Part of #520 (step 11). Changes existing output: decide whether it ships on by default or behind the option from #535.
CssMerger::merge() applies the HTML presentational attributes (mergeInlineAttributes(), src/Css/CssMerger.php:143) before the built-in defaults (mergeDefaultCss(), :144), so the defaults win. In CSS, presentational hints are author rules with zero specificity, applied after the user-agent stylesheet, so the attribute wins.
Measured on gravitypdf at b6a07921, PHP 8.5.4.
HTML
Browser
mPDF
<hr color="#ff0000">
red rule
grey: the HR default is color: #888888
<hr width="50%">
half width
full width: the HR default is width: 100%
<hr style="width:50%">
half width
half width
The same goes for vspace/hspace against the IMG default margin: 0, and valign against the TABLE/INPUT default vertical-align: middle.
Fix. Apply mergeInlineAttributes() after mergeDefaultCss(). color is taken from an attribute on any tag, so <a color="…"> would also beat the link's default blue, which a browser would not do. Consider limiting each attribute to the tags HTML defines it for.
Tests. The rows above, vspace on an image, and a stylesheet rule still beating the attribute.
Activity
jakejackson1 commentedon Sep 30, 2026
Fixed by #641.