Index: wp-includes/media.php
===================================================================
--- wp-includes/media.php	(revision 11091)
+++ wp-includes/media.php	(working copy)
@@ -651,26 +651,28 @@
 	$captiontag = tag_escape($captiontag);
 	$columns = intval($columns);
 	$itemwidth = $columns > 0 ? floor(100/$columns) : 100;
+	
+	$class = "galleryid-{$id}";
 
 	$output = apply_filters('gallery_style', "
 		<style type='text/css'>
-			.gallery {
+			.{$class} {
 				margin: auto;
 			}
-			.gallery-item {
+			.{$class} .gallery-item {
 				float: left;
 				margin-top: 10px;
 				text-align: center;
 				width: {$itemwidth}%;			}
-			.gallery img {
+			.{$class} img {
 				border: 2px solid #cfcfcf;
 			}
-			.gallery-caption {
+			.{$class} .gallery-caption {
 				margin-left: 0;
 			}
 		</style>
 		<!-- see gallery_shortcode() in wp-includes/media.php -->
-		<div class='gallery'>");
+		<div class='gallery $class'>");
 
 	$i = 0;
 	foreach ( $attachments as $id => $attachment ) {
