Title: Space between thumbnails
Last modified: August 19, 2016

---

# Space between thumbnails

 *  Resolved [lauradrouven](https://wordpress.org/support/users/lauradrouven/)
 * (@lauradrouven)
 * [16 years ago](https://wordpress.org/support/topic/space-between-thumbnails/)
 * Hi,
 * I use the fancy box gallery: [http://laura.drouven.nl/?p=89](http://laura.drouven.nl/?p=89)
 * I would like to have some space between the thumbnails and a border around them.
 * Could anyone tell me how to do this?
 * Thanks a lot!

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

 *  [Mark / t31os](https://wordpress.org/support/users/t31os_/)
 * (@t31os_)
 * [16 years ago](https://wordpress.org/support/topic/space-between-thumbnails/#post-1501975)
 * Add something like..
 *     ```
       a.fancybox img { border:1px solid #000; margin:2px 2px 0 0; }
       ```
   
 * ..to your stylesheet.
 * Larger border or margins will result in 3 images per row ..
 *  [Ben Dunkle](https://wordpress.org/support/users/empireoflight/)
 * (@empireoflight)
 * [16 years ago](https://wordpress.org/support/topic/space-between-thumbnails/#post-1501976)
 * Edit the style.css file in your theme folder as follows—add this line of code:
   `.
   attachment-thumbnail {padding:5px;border:2px solid #ccc}` Customize padding, 
   border width and border color values to your liking. HTH
 *  [Mark / t31os](https://wordpress.org/support/users/t31os_/)
 * (@t31os_)
 * [16 years ago](https://wordpress.org/support/topic/space-between-thumbnails/#post-1501978)
 * You ideally shouldn’t use padding, the box model for browsers differ, some browsers
   will include padding in the total width of an element, others won’t, giving you
   inconsistent display across browsers, margins don’t have that problem.
 * Previous suggested code could just as easily be..
 *     ```
       a.fancybox img.attachment-thumbnail { border:1px solid #000; margin:2px 2px 0 0; }
       ```
   
 * I’d be inclined to include the fancy box class as part of the definition since
   it was brought up by the poster, else you’re targetting all attachment thumbnails.
 *  Thread Starter [lauradrouven](https://wordpress.org/support/users/lauradrouven/)
 * (@lauradrouven)
 * [16 years ago](https://wordpress.org/support/topic/space-between-thumbnails/#post-1501988)
 * Thanks a lot for your fast reply. I have edit my style.css file with the code:
 * a.fancybox img.attachment-thumbnail { border:1px solid #000; margin:2px 2px 0
   0; }
 * and I tried
 * a.fancybox img { border:1px solid #000; margin:2px 2px 0 0; }
 * But it doesn’t work 🙁
 * So I removed the code again. Any other suggestions?
 * I am not really familiar with css or php. So maybe a strange question but does
   it matter where you put it within the style.css?
 * Thanks!
 *  [Mark / t31os](https://wordpress.org/support/users/t31os_/)
 * (@t31os_)
 * [16 years ago](https://wordpress.org/support/topic/space-between-thumbnails/#post-1501993)
 * If you’re placing it at the bottom of the stylesheet already, try this instead.
 *     ```
       a.fancybox img.attachment-thumbnail { border:1px solid #000!important; margin:2px 2px 0 0!important; }
       ```
   
 * ..else just move the code to the bottom.
 * Bottom most rules usually apply, but there is an ordering scheme to what rules
   win out, ID’s for example have a higher priority then classes (iirc). I can’t
   remember specifics or which wins out in the various cases, but “generally” the
   bottom most rule applies.
 *  Thread Starter [lauradrouven](https://wordpress.org/support/users/lauradrouven/)
 * (@lauradrouven)
 * [16 years ago](https://wordpress.org/support/topic/space-between-thumbnails/#post-1502050)
 * Thanks for your help again. I used
 * > a.fancybox img.attachment-thumbnail { border:1px solid #000; margin:2px 2px
   > 0 0; }
 * at the style sheet of the fancybox plugin and it worked. First, I only tried 
   it at my normal style.css file of my theme.
 * Thanks!!
 *  [Ben Dunkle](https://wordpress.org/support/users/empireoflight/)
 * (@empireoflight)
 * [16 years ago](https://wordpress.org/support/topic/space-between-thumbnails/#post-1502164)
 * t31-thx for the padding v. margin points, I’ll keep them in mind!

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

The topic ‘Space between thumbnails’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 7 replies
 * 3 participants
 * Last reply from: [Ben Dunkle](https://wordpress.org/support/users/empireoflight/)
 * Last activity: [16 years ago](https://wordpress.org/support/topic/space-between-thumbnails/#post-1502164)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
