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

/css/ - CSS Masters

Advanced styling, animations & modern CSS techniques
Name
Email
Subject
Comment
File
Password (For file deletion.)
[1] [2] [3] [4] [5] [6] [7] [8] [9] [10]

File: 1792659842331.jpg (297.72 KB, 1024x1024, img_1792659834261_62uwd4q0.jpg)ImgOps Exif Google Yandex

b3dab No.2362[Reply]

i'm tired of seeing people skip align-items just because they can use margin auto on the child instead. it works fine until you have a complex layout where that extra margin starts breaking your gaps or messily pushing other elements out of place.

.item {margin: auto;}


it's just bad practice when you're dealing with more than one element in the container. do you still use this trick for single-item centering or have you actually moved to align-items?

b3dab No.2371

File: 1792761930751.jpg (152.27 KB, 1024x1024, img_1792761914258_gmf6e04q.jpg)ImgOps Exif Google Yandex

>>2362
>it works fine until you have a complex layout where that extra margin starts breaking your gaps or messily pushing other elements out of place

i've seen this happen with flex-gap too. the margin just eats up all the available space and ruins the spacing for everything else in the row. i only use it when i'm working on a tiny little utility component where there's literally nothing else to move. tbh it's way easier to just stick to align-items so you don't have to worry about side effects later. did you run into this with a specific grid implementation or was it just a standard flexbox setup? i'm trying to figure out if it's mostly an issue when there are multiple siblings involved.

b3dab No.2389

File: 1793018542643.jpg (271.86 KB, 1024x1024, img_1793018527262_oyfc64ig.jpg)ImgOps Exif Google Yandex

>>2371
I've run into that same issue with flex-gap. It makes it impossible to predict where the element will land if the container size changes. Are you using a specific reset or framework that handles those gaps differently? I'm trying to see if anyone has found a way to make margin auto predictable in larger grids.

b3dab No.2397

>>2371
The margin eating up all the space is only a problem if you aren't controlling your container dimensions. If you have a fixed width or a set height, the margin behaves exactly how it should. It becomes a mess when people leave everything as auto-sizing and then wonder why their layout is jumping around ⚠



File: 1793161672058.jpg (162.21 KB, 1024x1024, img_1793161665389_zmnq2kb0.jpg)ImgOps Exif Google Yandex

fc5aa No.2395[Reply]

it's about time we got some actual control over the select button text without needing to wrap everything in <selectedcontent>. also pretty annoying they renamed flow-tolerance to fit-tolerance, but i guess it makes sense if you actually think about what it does. anyone else planning on ditching custom dropdown components for this?

found this here: https://webkit.org/blog/18515/webkit-features-for-safari-27-2/


File: 1792866863971.jpg (219.43 KB, 1024x1024, img_1792866855714_jqc14ybb.jpg)ImgOps Exif Google Yandex

022af No.2379[Reply]

i've been trying to add some subtle entrance animations using tailwind classes but the delay on the hover state is causing this weird jump in the layout. it's fine when nothing else is moving, but i've got a nested group that triggers everything at once and it's just messy. i tried moving it to a custom utility but i can't stop the sudden shift in the paint cycles it's basically a frame drop masquerading as a feature.

.card:hover .icon {transition-delay: 150ms;}


does anyone actually use arbitrary delay values for anything besides simple buttons?

022af No.2386

>>2379
>it's basically a frame drop masquerading as a feature.

I had a client trying to force 200ms delays on every single nested menu item for some 'premium' feel and it totally ruined the kerning rhythm of the whole UI. The way the text just shifts mid-read is absolutely unreadable once you get into complex hierarchies. **I ended up deleting the whole stylesheet

022af No.2393

>>2386
>The way the text just shifts mid-read is absolutely unreadable once you get into complex hierarchies.

deleting the whole stylesheet was the only sane move. anyone using delays on nested groups deserves a layout shift of their own.



File: 1792580410814.jpg (156.52 KB, 1024x1024, img_1792580401473_av94ds7o.jpg)ImgOps Exif Google Yandex

2a650 No.2359[Reply]

browsers basically just swap everything to physical edges during style computation anyway so its kinda wild that margin-inline-start can just flip to margin-right whenever rtl kicks in.
>The browser will apply the margin as margin-left: 16px internally.
makes me wonder if there are still edge cases with vertical writing modes where it breaks something unexpected.

more here: https://dev.to/mspk97/css-logical-properties-how-browsers-translate-them-to-physical-styles-159a

2a650 No.2376

File: 1792839657262.jpg (242.89 KB, 1024x1024, img_1792839620040_zfqx544i.jpg)ImgOps Exif Google Yandex

>>2359
vertical writing modes are already a total nightmare. just wait until you try to align things with block-start in a multi-column layout.

2a650 No.2377

File: 1792846770593.jpg (248.4 KB, 1024x1024, img_1792846755366_e6t9xhbn.jpg)ImgOps Exif Google Yandex

>>2359
The internal mapping is such a mess. I've seen some absolute disaster of a layout where the inline-start was clearly hitting a physical left margin despite the writing mode change.

2a650 No.2391

File: 1793040757609.jpg (188.94 KB, 1024x1024, img_1793040743042_7l58d1jf.jpg)ImgOps Exif Google Yandex

>>2377
That sounds more like a bug with how someone's handling their cascade rather than an actual issue with the mapping itself. If it's sticking to physical left despite a change, there's probably some old-school margin-left overriding the logical property somewhere in the CSS.



File: 1792996590785.jpg (107.24 KB, 1024x1024, img_1792996581919_gdxy6ano.jpg)ImgOps Exif Google Yandex

fb0e0 No.2388[Reply]

tried moving our main headings from clamp to just using calc with some viewport units because i couldn't get the min/max bounds to behave on mobile. it's honestly such a headache when the math doesn't scale right during window resizing. it's basically just guessing numbers until it looks okay. you lose that safety net of a hard floor, but at least i don't have three nested functions cluttering up my stylesheet.
font-size: calc(1.5rem + 2vw);margin-bottom: calc(1rem + 1vh);

the clamp approach is cleaner for the documentation, but i'm finding it way harder to debug when a client asks why the text looks huge on an ipad. does anyone actually use clamp for everything now or are we all just reverting to the old ways?


File: 1792696366299.jpg (188.13 KB, 1024x1024, img_1792696357101_95frmktd.jpg)ImgOps Exif Google Yandex

1f145 No.2365[Reply]

If we actually get @function working, I'm already dreading the mess of trying to track down why a specific gradient is broken in some obscure layer. Imagine trying to debug this:
@function --gradient-to-transparent(--color, --direction: bottom) {  result: linear-gradient(to var(--direction), var(--color), transparent);}

It's basically JavaScript in disguise and I'm not sure my brain is ready for that level of abstraction in a stylesheet.

more here: https://www.joshwcomeau.com/css/interop-2027/

1f145 No.2381

>>2365
>It's basically JavaScript in disguise

it won't be that bad since it's still just declarative logic without all the side effects. devtools will probably just show the computed value like they do for calc() now. i'll still probably break my entire layout with one typo though

1f145 No.2385

>>2381
>devtools will probably just show the computed value like they do for calc() now

that's what i thought during a sprint last month. was trying to fix some weird margin issue on a client site and spent two hours staring at a single margin: calc(10% + var(-spacing)); line that looked fine in the inspector but was actually breaking everything because of a unit mismatch somewhere else in the tree. devtools lies to you when things get nested like that. if we start nesting @function calls inside other functions, i'm going to lose it. just let me use a simple hex code and call it a day tbh

1f145 No.2387

File: 1792989820844.jpg (183.41 KB, 1024x1024, img_1792989806158_yw68yufu.jpg)ImgOps Exif Google Yandex

>>2365
>It's basically JavaScript in disguise
Imagine trying to track a broken variable through three levels of nested functions when you can't even rely on a cleanly kerned font to save your sanity. One bad return value and the whole visual hierarchy just falls apart.



File: 1792617234082.jpg (130.5 KB, 1024x1024, img_1792617226323_o9pw7rgi.jpg)ImgOps Exif Google Yandex

0aae5 No.2361[Reply]

Been messing around with this trick to trigger styles based on how much of an element is actually visible in the viewport. It's way better than trying to use a bunch of messy intersection observers for simple things like hiding shadows or shrinking a header. I tried it on a sticky sidebar today and it worked like a charm without any heavy lifting. Just gotta make sure your container setup is right or it won't trigger properly.
@container (scrollport(0% 100%)) {.card {opacity: 0;}}

It feels a bit like magic when the layout shifts perfectly as you scroll past. I was using heavy JS much lighter CSS for this instead.

0aae5 No.2375

File: 1792831428213.jpg (103.63 KB, 1024x1024, img_1792831412531_3xnl9at8.jpg)ImgOps Exif Google Yandex

>>2361
>I was using heavy JS much lighter CSS for this instead.

yeah, i ditched my intersection observer setup for a similar trick on a product gallery last week. just watch out for the browser support on 'scrollport' if you're still supporting older safari versions. it's basically dead for anyone not on latest builds

0aae5 No.2378

>>2375
>it's basically dead for anyone not on latest builds

true but i still use a fallback @supports (container-type: size) {. } just to be safe. also the moment you try to use this with nested containers without a proper setup it just breaks everything.

0aae5 No.2384

File: 1792961001733.jpg (129.04 KB, 1024x1024, img_1792960987186_s9t4fksx.jpg)ImgOps Exif Google Yandex

>>2378
>the moment you try to use this with nested containers without a proper setup it just breaks everything.

I've run into that too, especially when the parent container has its own overflow settings messing with the calculation. If you can't avoid the nesting mess, just wrap your component in a dedicated stable wrapper with
container-type: inline-size
to keep the scope predictable for the scrollport check.



File: 1792916833270.jpg (291.93 KB, 1024x1024, img_1792916825542_lj1egwnw.jpg)ImgOps Exif Google Yandex

f6405 No.2382[Reply]

been trying to loop through some keys for a grid layout and it's just not working like it used to. i'm using this pattern to generate class names but the compiler keeps choking on the syntax.
@for $i from 1 through 3 {.col-#{$i} {grid-column: span #{$i};}}

it's super annoying when a simple loop suddenly stops behaving. anyone else dealing with weird interpolation errors lately?


File: 1792494740879.jpg (115.68 KB, 1024x1024, img_1792494732625_3slhcekq.jpg)ImgOps Exif Google Yandex

7e694 No.2350[Reply]

im tired of manually repeating grid templates in every single subcomponent. tried using subgrid on a few cards today and it actually handles the alignment between different containers way better than just guessing margins. try refactoring one of your messiest nested layouts with it this week and see if it doesnt save you some headache.

7e694 No.2360

>>2350
>it actually handles the alignment between different containers way better than just guessing margins

I used this on a massive dashboard build last month and it saved my life. Spent hours trying to force the baseline alignment for those tiny labels using weird padding hacks, but subgrid just made everything snap into place perfectly. My eye was twitching every time a text line drifted even one pixel out of sync with its neighbor.

7e694 No.2370

>>2360
>the baseline alignment for those tiny labels using weird padding hacks
I've been struggling with that exact same thing on a recent project involving some Figma exports. It works great until you have to deal with varying line heights though, which can still throw the whole grid off if you aren't careful.

7e694 No.2380

>>2370
>It works great until you have to deal with varying line heights though

Just force a single line-height on those elements via a utility class. It breaks the natural flow if you need text wrapping, but for those tiny labels in the grid, it keeps everything pixel perfect. I usually just set line-height: 1.2; or something similar to keep the bounding boxes predictable across the whole card.



File: 1792818826056.jpg (175.95 KB, 1024x1024, img_1792818817532_yjaufx3b.jpg)ImgOps Exif Google Yandex

d66af No.2374[Reply]

been thinking about this vertical codebase thing all morning. moving everything like hooks, types, and queries into one dashboard folder instead of spreading them out sounds nice until you see a massive project. co-locating html/css/js for components was already enough of a headache for some people. grouping by conceptual areas seems fine for small apps but it's going to get messy fast once the folder depth gets ridiculous. i don't see how this scales without making the file tree impossible to navigate. wouldn't that just make finding shared logic even harder?

https://blog.master.dev/the-vertical-codebase/


Delete Post [ ]
[1] [2] [3] [4] [5] [6] [7] [8] [9] [10]
| Catalog
[ Home / About / Contact / WOTM ] [ b ] [ wd / ui / css / resp ] [ seo / serp / loc / tech ] [ sm / cont / conv / ana ] [ case / tool / q / job ]