Adding CSS To Images
-
I’ve been looking around for a way to automatically apply CSS style to images which are inserted in a post or page and wasn’t able to find anything. I’m not talking about what happens when you click on an image…just how it appears in the post or page.
I think I’ve figured it out so here it is in case someone else is looking to do the same:
Edit your theme style.css file and add the following:
.cboxElement img { border-style: solid; border-width: thin; border-color: #999; padding: 4px; margin-left: 10px; margin-bottom: 10px; }
Edit as needed…this one just puts a thin grey border around the image with some padding. And since my images are usually right justified, I added an extra margin on the left to give it some breathing room.
The important part is that it applies the style to the .cboxElement automatically so all you need to do is insert the image.
- The topic ‘Adding CSS To Images’ is closed to new replies.