Sometimes you can just drop an image right in to your site.

For example, if your image’s background and the site’s background are the same (or even better, the image’s background is transparent) then you’re probably just good-to-go, like this:

Iphone-1

However when you have an image with a different background color,

Various_iPods    Various_iPods

Or especially a changing border background color that’s inconsistent around the four sides,

after
after

A proper border can help create a smooth transition between your image and the rest of the page. It’ll make your post look a lot better without much work at all.

Quick & Easy CSS Borders in WordPress

Just follow these four simple steps from your WordPress dashboard.

1. Navigate to “Appearance” > “Edit CSS”

Screen_Shot_2015-08-10_at_8_43_43_PM

2. Add the Following Custom CSS

Add this CSS to your CSS Stylesheet Editor:


 img.my-border {
 -webkit-box-shadow: 0 2px 4px 1px rgba(0,0,0,0.5);
 -moz-box-shadow: 0 2px 4px 1px rgba(0,0,0,0.5);
 box-shadow: 0 2px 4px 1px rgba(0,0,0,0.5);
 border-radius: 3px 3px 3px 3px;
 }
 

Of course you can modify these values, but I find that they’re effective without being over-the-top distracting from the image.

3. Click “Save Stylesheet”

Screen_Shot_2015-08-10_at_8_50_56_PM

4. Add Your New Custom CSS Class

Now when you’re writing your post follow these simple steps.

  1. Insert your image
  2. Select your image to bring up the bar of editing icons
  3. Click the pencil icon from the visual editor
  4. Type “my-border” in the Image CSS Class field

Screen_Shot_2015-08-10_at_8_53_15_PM

Screen_Shot_2015-08-10_at_8_55_04_PM

That’s it!