Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Welcome to Software Development on Codidact!

Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.

Images won't fit flex container on chrome

+2
−0

I browse deviantArt from time to time and I wanted to make images display bigger, because there is so much useless whitespace on that site.

On first glance that would be simple - remove the set dimensions of the image element and the overly conservative srcset.

Because it's a react site, and will reset the style any time you resize the viewport, I use some agressive css. The site's style already includes max-width: 100% and max-height: 100%, which are also important. Here's the changes in userscript form

// ==UserScript==
// @name     deviantArt expand images
// @version  1.0
// @grant    GM_addStyle
// @match    https://www.deviantart.com/*
// ==/UserScript==

document.querySelector('._28lPU').removeAttribute('srcset')

GM_addStyle(`
._28lPU {
    height: unset !important;
    width: unset !important;
}
`)

Alternatively, just open dev tools and delete these properties manually. Here's a page to test on: https://www.deviantart.com/hexanity/art/Helldivers-2-Orbital-bombing-1039305812

Based on what I know about flexbox and images, this should allow the image stretch up to it's native size to fill its flexbox container.

However this doesn't happen on chrome. Image remains tiny. Works as expected in firefox.

I tried to isolate the problem, but was unable to: https://jsfiddle.net/n9k2853c/

There's a few things I'm looking for here:

  1. This is a bug in chrome, right? (And is not my understanding or firefox that is broken?)
  2. Help isolating the problem, so perhaps it can be reported.
  3. Help finding a workaround.
History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.
Why should this post be closed?

0 comment threads

1 answer

+1
−0

#3: I still don't know what exactly is going on, but experimenting today, I found a workaround at least:

align-items: normal; on the container and object-fit: scale-down; on the image.

Due to the way object-fit works, it circumvents the problem on chrome.

#1: But this does highlight another inconsistency. The description of scale-down is:
Size the content as if none or contain were specified, whichever would result in a smaller concrete object size.
This statement is lifted directly from the spec, but it is not true on chrome, providing another hint that it is indeed a bug! none behaves differently than scale-down on chrome! Example - though demonstrating the problem will depend on the resolution of your screen.

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.

0 comment threads

Sign up to answer this question »