Jump to content

Not able to add class or width="100%" to image which is inserted in CKeditor


Recommended Posts

Posted

Hi,

Anyone knows if it is possible to prevent the ckeditor add width to the image and how can I add class / width="100%" to an image??

Please, I know I can do this with a piece of  JS but I don't want to do it with JS.

Gideon

Posted

Afaik CSS has precedence over HTML width.

So either define width:100% for all your images or insert a special class for this (e.g. "img_responsive").

.img_responsive {
  width: 100%; }  

 To make it selectable from the CKE toolbar, do sth. like

CKEDITOR.stylesSet.add('mystyles', [
    { name: 'Fullwidth', element: 'img', attributes: { 'class': 'img_responsive' } }
]); 

 

  • Like 2

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...