Set custom sizes attribute on img in the post editor
-
I would like to set a custom
sizes
attribute on eachimg
tag in the post editor.In my theme, my css will always make a certain row of images all display at 33% of the view width. I would like to able to set the
sizes
attribute on each of these images to something like33vw
.When I add a
sizes
attribute to an image tag in a post, your plugin just adds anothersizes
attribute specifying full width.In the posts editor:
<img src="[url]" alt="[alt]" height="2000" width="3000" sizes="33vw"/>
Compiles to:
<img src="[url]" alt="[alt]" height="2000" width="3000" sizes="33vw" srcset="[image sizes list]" sizes="(max-width: 3000px) 100vw, 3000px"/>
Is there any way to specify a
sizes
attribute for each image used in the posts editor? I don’t want to use100vw
in every case.Thanks,
-James
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Set custom sizes attribute on img in the post editor’ is closed to new replies.