我希望能够添加已在 CSS 文件中定义的自定义 CSS 样式。我阅读了文档here和here,但它不起作用。
**django-ckeditor 版本 **
django-ckeditor 6.7.1
这是ckeditor配置
CKEDITOR_CONFIGS = {
'default': {
'allowedContent': True,
'stylesSet':[
{
'name':'highlighted-text', 'element':'div', 'attributes':{'class':'highlighted-text'}
},
],
'toolbar': 'Custom',
'toolbar_Custom': [
['Bold', 'Italic', 'Underline'],
['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
['Link', 'Unlink'],
['RemoveFormat', 'Source', 'Image', 'Table']
],
}
}
**这就是 django-ckeditor 的样子 **
有什么想法吗?
我会给出一个一般性的答案。这意味着,将覆盖所有场景。
方法:使用自定义css样式文件
方法论-
1) 在 chrome(任何您喜欢的浏览器)上打开所需的网页(您想要自定义的页面/区域)
2) 右键单击您想要设置样式/自定义的区域
3) 单击“在
debug mode
(浏览器上下文菜单)中打开”
4) 找到您想要定制的
elements
5) 将
class
复制到新的文本文件
6) 添加您的样式,如下所示
.coped_class_name{
color:green !important;
}
使用扩展名
.css
保存此文件。
和
将此文件移动/复制到 django 静态文件夹。
8) 将此 css 文件添加到您想要的页面。 和 刷新页面。 如果样式没有显示,请重新启动服务器。