question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to add a css class to an img element

See original GitHub issue

img src=“” class=“img-fluid” alt=“Responsive image”

const range = quill.getSelection(); quill.insertEmbed(range.index, ‘image’, ${url}); quill.pasteHTML(range.index, <img src="${url}" class="img-fluid" alt="Responsive image">);

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:12 (2 by maintainers)

github_iconTop GitHub Comments

22reactions
ModPhoenixcommented, Sep 29, 2017
var Image = Quill.import('formats/image');
Image.className = 'img-fluid';
Quill.register(Image, true);
7reactions
ModPhoenixcommented, Sep 30, 2017
var Image = Quill.import('formats/image');
  Image.className = 'img-fluid';
  Quill.register(Image, true);

  const quill = new Quill('#editor-container', {
    modules: {
      toolbar: '#toolbar-container'
    },
    placeholder: 'Compose ansdfdsfsdf epic...',
    theme: 'snow'
  });
Read more comments on GitHub >

github_iconTop Results From Across the Web

Assign a class name to <img> tag instead of write it in css file?
The short answer is adding a class directly to the element you want to style is indeed the most efficient way to target...
Read more >
HTML img class Attribute - Dofactory
Two CSS classes are defined in the <style> element. The class attribute in <img> assigns a single classname. Repeatedly clicking the button toggles...
Read more >
Adding Image Classes | Sitecore CMS Support
How to Apply Classes to Images · Upload the image, add an alt tag, and insert your image into the Body field. ·...
Read more >
W3.CSS Images - W3Schools
<img src="img_lights.jpg" alt="Lights" class="w3-image">. Try It Yourself ». If you want the image to scale both up and down on responsiveness, set the...
Read more >
Set Image Class Names for Styling in CSS - Paligo
One way to add a class name for an image is to use taxonomy tags: Select Layout and then edit the HTML5 layout...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found