Search code examples
javascriptphpjqueryckeditor

Adding inline styles to multiple elements in ckeditor


I need to add inline style to multiple html elements using the inline style option in the ckeditor. I have added the following code in the styles.js file.

 { name: 'Red italics', element: 'p', styles: {'font-style' : 'italic', 'color' : '#632423'} },

I need to add the styling to multiple html tags , something like the below

{ name: 'Red italics',  element: 'p, div, li', styles: {'font-style' : 'italic', 'color' : '#632423'} },

but this does not work. Can anyone please tell me how can I do the above.

Thanks in advance.

Regards,

Neha


Solution

  • Please try this solution..

    { name: 'Red italics', element : ['p', 'div', 'li'], styles: {'font-style' : 'italic', 'color' : '#632423'}  }
    

    let me know if it helps you...

    EDIT

    if that does not work then try below code

    { name: 'Red italics', element : ['p', 'div', 'li'], attributes: {'font-style' : 'italic', 'color' : '#632423'}  }