Created
April 16, 2014 23:50
-
-
Save cramdesign/10943010 to your computer and use it in GitHub Desktop.
WordPress 3.9 ships with the ability to add HTML5 support for galleries which will now use figure and figcaption to display images. This is a huge change for the better! Bonus: br tag used for clearing rows has been cleaned out as well. While all of this is good news for more semantic markup, one might now be left wondering how to style the new …
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* WordPress Gallery | |
------------------------------------------ */ | |
.gallery { | |
margin-left: -0.5em; | |
margin-right: -0.5em; | |
} | |
.gallery:after { | |
display: table; | |
content: ""; | |
clear: both; | |
} | |
.gallery-item { | |
margin: 0; | |
float: left; | |
padding: 0.5em; | |
} | |
.gallery-item img { | |
width: 100%; | |
} | |
.gallery-columns-1 .gallery-item { | |
width: 100%; | |
float: none; | |
} | |
.gallery-columns-2 .gallery-item { | |
width: 50% | |
} | |
.gallery-columns-3 .gallery-item { | |
width: 33.3333% | |
} | |
.gallery-columns-4 .gallery-item { | |
width: 25% | |
} | |
.gallery-columns-5 .gallery-item { | |
width: 20% | |
} | |
.gallery-columns-6 .gallery-item { | |
width: 16.6667% | |
} | |
.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-columns-2 .gallery-item:nth-child(2n+1), | |
.gallery-columns-3 .gallery-item:nth-child(3n+1), | |
.gallery-columns-4 .gallery-item:nth-child(4n+1), | |
.gallery-columns-5 .gallery-item:nth-child(5n+1), | |
.gallery-columns-6 .gallery-item:nth-child(6n+1), | |
.gallery-columns-7 .gallery-item:nth-child(7n+1), | |
.gallery-columns-8 .gallery-item:nth-child(8n+1), | |
.gallery-columns-9 .gallery-item:nth-child(9n+1) { | |
clear: left; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Genesis users could also use the built Bootstrap column classes couldn't you?
Here's another way to fix the problem http://www.studiopress.com/forums/topic/executive-pro-wordpress-native-gallery/#post-126397