Search code examples
javascriptckeditor

Change default size of the <p> tag in CKEditor


I want to change the default font size of the CKEditor <p> tag.

I have tried all given options in documentation but nothing is working.

config.format_p = { element: 'p', attributes: { 'class': 'normalPara' } };
config.format_p = { element: 'p', attributes: { 'style': 'font-size:20px' } };

config.fontSize_defaultLabel = '12px';

config.fontSize_style = {
    element:        'p',
    styles:         { 'font-size': '#(size)' },
    overrides:      [ { element: 'font', attributes: { 'size': '100px'} } ]
};

Solution

  • Adjust the default style available in the contents.css file. You can use the config.contentsCss configuration option to point to your custom styles (to avoid overwriting changes introduced to the default contents.css file on upgrade).