Last active
September 7, 2018 15:45
-
-
Save JayPanoz/812c25dc01e0745c6f5d56ecb964f721 to your computer and use it in GitHub Desktop.
Experimental CSS to get portrait-aspect-ratio image + caption on same page, on reflow
I applaud you, sir, even if all of this hoop-jumping makes me want to cry.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Further details + notes
height, max-height and min-height
As a reminder:
So you can set a
max-height
if there is nomin-height
(fallbacks) but you’ll have to!important
it for some reason (I guess becausevh
?).I can’t get the “reflow image please” part to behave with
max-height
, even when setting amin-height
smaller than themax-height
(inpx
). So maybeheight: calc()
is the culprit. I really don't know, found absolutely nothing about that.Edit: Or maybe it is once again those fucking RS overrides since it it working as intended in web browsers.
So the workaround is to make sure your pictures are freaking huge enough so that you don’t need
max-height
.iBooks
iBooks won’t take your max-height into account, at all. I guess there is a bug when
vh
are used. Though the inspector shows iBooks’ defaultmax-height: 95%
is overridden by your ownmax-height
, applied styles showmax-height: 95%
is being used… which means:Edit: Or maybe it is twice again those fucking RS overrides + an iBooks bug on top of it, dropping the
max-height
whenheight
invh
orcalc()
since it it working as intended in web browsers.So the workaround is to make sure your pictures are freaking huge enough so that you don’t need `max-height.
Constrain caption’s font-size
There’s one trick if you want to constrain the caption’s
font-size
on iOS:-webkit-text-size-adjust: [x * 100]%
. Used it in the past and It works at least in iBooks but I didn't check for this nugget so please correct me if I'm wrong.