I am using htmlpurifier to clean up user content. I am trying to remove inline style attributes like
<div style="float:left">some text</div>
I want to remove the whole style attribute.
How to do it using htmlpurifier?
You can tweak the AllowedProperties configuration by passing it an array of valid css attributes that should not be removed (white-list approach).
However, the following should remove all css attributes
$config->set('CSS.AllowedProperties', array());
See this online demo of purifying your input html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With