0

I have written a full html code

<div style="background-color:red">&nbsp;</div>

But when I edit the content and click on the "Source" button provided in the CKEditor toolbar. nothing is showing up

In Advanced content filter I have given in Extra allowed content

p(*)[*]{*};div(*)[*]{*};li(*)[*]{*};ul(*)[*]{*} 

In Custom JavaScript configuration I have given

config.allowedContent = true;
0

I know D8's CKEditor doesn't allow you to use the style attribute to prevent click jacking attacks, example.

Can't remember if D7 CKeditor did or not, but either way, it's bad security practice to allow people to use style attribute.

The better approach is to use a class.

<div class="bg-red">...something goes here...</div>

Your Drupal theme's style.css

.bg-red { 
  background-color:red;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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