htmlpurifier remove inline css
Asked Answered
S

1

10

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?

Spiritual answered 16/1, 2012 at 14:5 Comment(0)
T
21

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

Tome answered 16/1, 2012 at 14:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.