I've been trying to give background-color to ckeditor but nothing seems to work.
looked at the class names in browser inspect and tried to write style relative to those classes, but it didn't work. I think it overrides them.
can anyone help me out?
CodePudding user response:
- Check if the styles you wrote were loaded properly, you should see them in the dev tools with a strikethrough if they're not applied
- increase the specificity of the styles, either by giving them a parent so it'd be
.parent .class {}
or if that's not enough to override the class of CKEditor you can keep increasing the specificity or adding!important
, I prefer not using important unless if I must, because you may want to override the override later.
CodePudding user response:
The background colour of the ckeditor5 window is defined using a CSS variable like this:
.ck.ck-editor__main>.ck-editor__editable {
background: var(--ck-color-base-background);
border-radius: 0;
}
You can customise the appearance but importing a new CSS file that overwrites these variables. They provide a good guide here: https://ckeditor.com/docs/ckeditor5/latest/framework/guides/deep-dive/ui/theme-customization.html