Title: Image css
Last modified: February 9, 2021

---

# Image css

 *  [parkinternet](https://wordpress.org/support/users/parkinternet/)
 * (@parkinternet)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/image-css/)
 * i want to add css class to my all images how can i do it? such that i can use
   that css class to custom css section. is there any hook available or any php 
   snippet?
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fimage-css%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [George Appiah](https://wordpress.org/support/users/gappiah/)
 * (@gappiah)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/image-css/#post-14026821)
 * > i want to add css class to my all images
 * If you want to add one class to “ALL” your images as you say… why do you need
   to do this at all? Wouldn’t it be better to target the `img` tag directly?
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/image-css/#post-14027478)
 * You could use the ‘wp_insert_post_data’ filter to search through post content
   to find img tags and their related class attribute. If your desired class is 
   not already there, it could be inserted. This filter fires just before a post
   is inserted into the DB.
 * Since finding the class attribute involves first finding all img tags, George
   brings up a very good point. But the answer to your question is above all the
   same.
 *  Thread Starter [parkinternet](https://wordpress.org/support/users/parkinternet/)
 * (@parkinternet)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/image-css/#post-14028726)
 * [@gappiah](https://wordpress.org/support/users/gappiah/) i am not writing my 
   posts on post section so that i can’t change the html and add inline css class
   to it, my image is on my media library and i want to place it into my elementor
   designing template but i need that image css to customise it, but how can i make
   the css class of that image? is there any plugin to do that or an any php code
   to directly insert random css class to each image.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Image css’ is closed to new replies.

## Tags

 * [css](https://wordpress.org/support/topic-tag/css/)
 * [css classes](https://wordpress.org/support/topic-tag/css-classes/)
 * [image](https://wordpress.org/support/topic-tag/image/)
 * [image css](https://wordpress.org/support/topic-tag/image-css/)

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 3 replies
 * 3 participants
 * Last reply from: [parkinternet](https://wordpress.org/support/users/parkinternet/)
 * Last activity: [5 years, 2 months ago](https://wordpress.org/support/topic/image-css/#post-14028726)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
