Skip to content

Instantly share code, notes, and snippets.

@GaryJones
Last active January 11, 2016 05:19
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GaryJones/9530251 to your computer and use it in GitHub Desktop.
Save GaryJones/9530251 to your computer and use it in GitHub Desktop.
Default styles for HTML5 galleries and captions.
<?php
add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption' ) );
.gallery {
margin: auto;
}
.gallery-item {
float: left;
margin-top: 10px;
text-align: center;
}
.gallery-columns-2 .gallery-item {
width: 50%;
}
.gallery-columns-3 .gallery-item {
width: 33%;
}
.gallery-columns-4 .gallery-item {
width: 25%;
}
.gallery-columns-5 .gallery-item {
width: 20%;
}
.gallery-columns-6 .gallery-item {
width: 16.6666%;
}
.gallery-columns-7 .gallery-item {
width: 14.2857%;
}
.gallery-columns-8 .gallery-item {
width: 12.5%;
}
.gallery-columns-9 .gallery-item {
width: 11.1111%;
}
.gallery img {
border: 2px solid #cfcfcf;
}
.gallery-caption {
margin-left: 0;
}
@GaryJones
Copy link
Author

Amended from the old default styles - see gallery_shortcode() in wp-includes/media.php

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment