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.

Post History

66%
+2 −0
Q&A Images won't fit flex container on chrome

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 di...

1 answer  ·  posted 9mo ago by martixy‭  ·  last activity 9mo ago by martixy‭

Question css chrome debugging
#2: Post edited by user avatar martixy‭ · 2024-04-09T17:08:10Z (9 months ago)
  • 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 fit 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.
  • 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.
#1: Initial revision by user avatar martixy‭ · 2024-04-09T17:06:23Z (9 months ago)
Images won't fit flex container on chrome
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 fit 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.