Added caption sytle for hyperlinked images (#144).

This commit is contained in:
Cotes Chung 2020-10-07 12:24:25 +08:00
parent c221a3e0bc
commit cb908bbb2b
3 changed files with 51 additions and 18 deletions

View file

@ -816,19 +816,18 @@ div.post-content .table-wrapper {
margin-top: 2rem; margin-top: 2rem;
overflow-wrap: break-word; overflow-wrap: break-word;
word-wrap: break-word; word-wrap: break-word;
a {
@extend %link-color; @mixin img {
@extend %link-underline;
&:hover {
@extend %link-hover;
}
}
p {
font-size: 1.08rem;
> img { > img {
&:not([style]) { &:not([style]) {
margin: .5rem 0; margin: .5rem 0;
@include align-center; @include align-center;
@include img-caption;
}
}
}
@mixin img-caption {
+ em { + em {
display: block; display: block;
text-align: center; text-align: center;
@ -837,9 +836,25 @@ div.post-content .table-wrapper {
padding: 0; padding: 0;
color: #6d6c6c; color: #6d6c6c;
} }
}
a {
&:not(.img-hyperlink) {
@extend %link-color;
@extend %link-underline;
&:hover {
@extend %link-hover;
} }
} }
&.img-hyperlink {
@include img;
@include img-caption;
}
}
p {
font-size: 1.08rem;
@include img;
}// p }// p
} }

View file

@ -0,0 +1,16 @@
/*
* Find out the <a> tag contains an image and mark it.
*
* v2.5.1
* https://github.com/cotes2020/jekyll-theme-chirpy
* © 2020 Cotes Chung
* MIT Licensed
*/
$(function() {
var MARK="img-hyperlink";
$("a:has(img)").addClass(MARK);
});

View file

@ -13,3 +13,5 @@ layout: compress
{% include_relative lib/_bootstrap-toc.min.js %} {% include_relative lib/_bootstrap-toc.min.js %}
{% include_relative _utils/toc-filter.js %} {% include_relative _utils/toc-filter.js %}
{% include_relative _utils/img-hyperlink.js %}