4

I'm using the "Limit allowed HTML tags" filter in my text format and put this to the allowed tags: <th style>

Anyway my table styling <th style="width: 60%;"> added in Ckeditor is filtered out. What have I missed?

2 Answers 2

1

The "Limit allowed HTML tags" filter triggers Drupal's XSS filter, which strips all style attributes. So you cannot use style attributes and "Limit allowed HTML tags" at the same time.

There are stalled efforts to eventually address this by modifying how Drupal performs XSS filtering.

1

style="width: 60%;" is an html attribute, not a tag.

I put this to the allowed tags: <th style>

Therefore, you need to remove the style part and just put table header tag <th> in the allowed tags.

2
  • 6
    It's possible to allow attributes for a tag. But not style, which is always removed by the "Limit allowed html tags" filter, because you can use it for XSS attacks.
    – 4uk4
    Jan 5, 2017 at 7:44
  • 2
    ok, there is really nothing which doesn't exist... so, then I have no choice than adding classes and style it in the css file.
    – 0711master
    Jan 5, 2017 at 10:31

Not the answer you're looking for? Browse other questions tagged or ask your own question.