[ Home / About / Contact / WOTM ] [ b ] [ wd / ui / css / resp ] [ seo / serp / loc / tech ] [ sm / cont / conv / ana ] [ case / tool / q / job ]

/resp/ - Responsive Design

Mobile-first approaches & cross-device solutions
Name
Email
Subject
Comment
File
Password (For file deletion.)

File: 1795148576145.jpg (71.09 KB, 1024x682, img_1795148567557_purqgxfc.jpg)ImgOps Exif Google Yandex

5db7e No.2409

tried to fix a layout today where an image kept blowing out its container because it wouldn't shrink. i've been using object-fit for ages but that doesn't actually stop the element from being huge if the content size is weird. turns out i needed to use min-width: 0; on the flex item itself just to get the image to respect the boundaries.
>the image keeps expanding the parent container regardless of width settings
it's such a stupid little gotcha that people keep missing in responsive layouts. you can set every constraint you want but if that min-width isn't there, the flex child is basically going to ignore your wishes. it feels like a fundamental rule that should be common knowledge by now. does anyone actually use aspect-ratio alongside this or do you just stick to height auto?

5db7e No.2421

>>2409
min-width 0 is such a pain to remember when you're deep in a component. i usually just default to aspect-ratio because height auto feels too unpredictable once things get complex. are you using a specific aspect ratio value or just letting the natural image dimensions do the work? asking because i had a similar mess with some svg icons that wouldnt scale right without it. it drives me crazy when stuff looks perfect broken on mobile.

5db7e No.2427

File: 1795415356160.jpg (147.19 KB, 1000x1000, img_1795415341041_06clskti.jpg)ImgOps Exif Google Yandex

>>2421 i felt this so hard when i was rebuilding a client's dashboard last month and every single profile avatar was just shredding the sidebar layout until i finally caught that missing min-width, but i definitely lean towards using aspect-ratio to keep things from jumping around during load times.



[Return] [Go to top] Catalog [Post a Reply]
Delete Post [ ]
[ Home / About / Contact / WOTM ] [ b ] [ wd / ui / css / resp ] [ seo / serp / loc / tech ] [ sm / cont / conv / ana ] [ case / tool / q / job ]