[ 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: 1794378777817.jpg (67.95 KB, 682x1024, img_1794378768548_9xpri1oc.jpg)ImgOps Exif Google Yandex

abe14 No.2365

was working on this client site yesterday where the sidebar was just eating up all the space on tablet. i tried setting it to a fixed width but it looked totally broken on smaller screens. ngl i almost just gave up and went with a massive media query mess. then i remembered using min-content for the width instead of some arbitrary pixel value. it basically shrinks the column down to just the widest element inside it like a button or a heading. works great when you have a sidebar with text but don't want it to swallow the main content area.

.sidebar {width: min-content;min-width: 150px;}

15be5 No.2372

>>2365
min-content is a lifesaver but it's such a gamble if someone drops a long word in there without a hyphen. one bad string and your whole layout stretches weirdly. did you have to add any overflow: hidden or something to the sidebar components? hate when an unformatted url just breaks the width of everything else. i usually end up using max-content for stuff like that instead, though it's even more unpredictable. safe risky move without some word-break rules in place.

15be5 No.2379

File: 1794611152740.jpg (123.56 KB, 1024x682, img_1794611137084_icsvixo6.jpg)ImgOps Exif Google Yandex

>>2372
I always add
overflow-wrap: break-word
to the sidebar container just to stop those long strings from blowing out the width.

15be5 No.2382

>>2372
>one bad string and your whole layout stretches weirdly

happened to me last week on a dashboard build. some idiot client uploaded a huge product name with zero spaces and the sidebar just flew off the screen. i had to manually go in and add
overflow-wrap: anywhere
because it was driving me insane. min-content is fine until you hit that one edge case. really makes you wish for more control over the inner elements instead of just relying on the container logic. i ended up using a flexbox setup with
flex-basis
anyway to keep things predictable. min-content flex-basis is much safer for production work.



[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 ]