Image in a modal (CSS question)

37 views
Skip to first unread message

Hubert

unread,
Jan 30, 2020, 11:51:47 AM1/30/20
to TiddlyWiki
Hello,

When I'm displaying images in a modal I see scroll bars: a large image is not resized to fit the modal window.

I've tried object-fit: contain; and max-width with vw values hoping that the image would be resized to fit modal window, but I've had no luck so far.

Just to note, I'm not using absolute positioning or absolute values (like px) anywhere.

Is there anything specific in regards to how tc.modal and its children handle images? I'm on mobile so can't check that conveniently at the moment. Still, I would appreciate advice if anyone is aware of any styling constraints that stand out.

Many thanks in advance.

Regards,
Hubert

Hubert

unread,
Jan 30, 2020, 2:10:05 PM1/30/20
to TiddlyWiki
OK, I've solved it with:

.tc-modal img {
width: 100%;
object-fit: contain;
}

Reply all
Reply to author
Forward
0 new messages