summaryrefslogtreecommitdiff
path: root/assets/css/components/_shortcodes.scss
diff options
context:
space:
mode:
authorEltrac <hi@guhub.cn>2025-06-13 16:06:41 +0800
committerEltrac <hi@guhub.cn>2025-06-13 16:06:41 +0800
commitbc02375be7268edc78f4a00badc4b2292cc1a96f (patch)
tree6649261e98d1594cf2537775cc9b157302247b64 /assets/css/components/_shortcodes.scss
parentc4aac4634a5fbe31a8e268e0f6a21b7b2cc6f9d1 (diff)
fix: image caption being wider than image
Use `position: absolute` for `<figcaption>`, not affecting the container's width. Also rewrite `<figure>` `<figcaption>` style.
Diffstat (limited to 'assets/css/components/_shortcodes.scss')
-rw-r--r--assets/css/components/_shortcodes.scss29
1 files changed, 25 insertions, 4 deletions
diff --git a/assets/css/components/_shortcodes.scss b/assets/css/components/_shortcodes.scss
index 934417d3..5c4e893a 100644
--- a/assets/css/components/_shortcodes.scss
+++ b/assets/css/components/_shortcodes.scss
@@ -76,18 +76,39 @@
display: flex;
overflow-x: auto;
scroll-behavior: smooth;
- gap: 1rem;
+ gap: 0.5rem;
white-space: nowrap;
- & > figure {
- display: inline-block;
+ & > figure, & > a:has(> figure) {
margin: 0;
flex-shrink: 0;
+ display: inline-block;
+ max-width: 100%;
+ position: relative;
+ box-shadow: inset 0 -2rem 2rem -2rem rgba(0, 0, 0, 0.1);
img {
height: 20rem;
- object-fit: cover;
display: block;
border-radius: 4px;
+ margin: 0;
+ }
+ figcaption {
+ position: absolute;
+ bottom: 0;
+ left: 0;
+ padding: 0.35rem;
+ h4 {
+ font-size: 0.8rem;
+ margin: 0;
+ text-align: left;
+ width: fit-content;
+ color: var(--text-color);
+ background-color: rgba(var(--block-background-color-rgb), 0.75);
+ backdrop-filter: blur(0.5rem);
+ padding: 0.2rem 0.35rem;
+ border-radius: 3px;
+ line-height: 1.2;
+ }
}
}
& > p { display: none }