Last active
January 19, 2019 17:46
-
-
Save adamcapriola/1ad514f5be0c74aed677c054f9e96ae7 to your computer and use it in GitHub Desktop.
CSS for images with source links
This file contains 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
/* sources */ | |
.image-wrap { | |
position: relative; | |
} | |
figure.wp-caption .image-wrap { | |
display: block; | |
} | |
.image-wrap-none, | |
.image-wrap-center { | |
display: block; | |
position: relative; | |
} | |
.image-wrap-center { | |
margin: 0 auto 1.7em; | |
} | |
.image-wrap-right, | |
.image-wrap-left { | |
display: inline-block; | |
float: right; | |
position: relative; | |
} | |
.image-wrap-left { | |
float: left; | |
} | |
figure.wp-caption .source, | |
.image-wrap .source { | |
background: rgba(0,0,0,0.5); | |
font-family: 'freight-sans-pro', sans-serif; | |
font-size: 10px; | |
font-size: 1rem; | |
letter-spacing: 0.5px; | |
line-height: 1; | |
position: absolute; | |
text-transform: uppercase; | |
-webkit-transition: opacity 0.2s ease-in-out; | |
-moz-transition: opacity 0.2s ease-in-out; | |
-o-transition: opacity 0.2s ease-in-out; | |
transition: opacity 0.2s ease-in-out; | |
opacity: 0; | |
} | |
figure.wp-caption:hover .source, | |
.image-wrap:hover .source { | |
opacity: 1; | |
} | |
figure.wp-caption .source a, | |
.image-wrap .source a { | |
border: 0 !important; | |
color: #fff !important; | |
display: block; | |
padding: 3px 5px; | |
text-decoration: none !important; | |
} | |
figure.wp-caption .source a:hover, | |
.image-wrap .source a:hover { | |
text-decoration: underline !important; | |
} | |
/* any with caption */ | |
figure.wp-caption .source { | |
bottom: 4px; | |
right: 4px; | |
} | |
figure.wp-caption.alignleft .source { | |
left: 4px; | |
right: inherit; | |
} | |
/* no captions */ | |
.image-wrap-none .source { | |
bottom: 4px; | |
right: 4px; | |
} | |
.image-wrap-right .source { | |
bottom: 34px; | |
right: -11px; | |
} | |
.image-wrap-left .source { | |
bottom: 34px; | |
left: -11px; | |
} | |
.image-wrap-center .source { | |
bottom: 4px; | |
right: 4px; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment