[ 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: 1791875287874.jpg (273.46 KB, 1024x1024, img_1791875279916_1nkkz8im.jpg)ImgOps Exif Google Yandex

fcbcf No.2312[Reply]

I'm seeing some weirdness with nested grids on older iOS versions. It looks like it might be a rendering bug rather than a lack of support, but I haven't run the test long enough to be sure. Hard to tell if this is just a temporary glitch or something more permanent systemic without more data.
.parent {display: grid;}.child {display: grid;grid-template-rows: subgrid;}


File: 1791795625860.jpg (171.98 KB, 1024x1024, img_1791795618274_48k1vrgt.jpg)ImgOps Exif Google Yandex

49542 No.2308[Reply]

I'm tired of seeing people manually calculate height for every single card component. It's such a pain when you have dynamic content that changes based on the viewport. Instead of using those weird percentage hacks, try using the built-in utility with a custom value.
aspect-[16/9]aspect-[4/3]

It keeps the layout stable without needing to mess with padding-top tricks anymore. Just make sure you aren't overusing it on containers that might grow vertically.


File: 1791428393179.jpg (212.23 KB, 1024x1024, img_1791428384192_th5woqks.jpg)ImgOps Exif Google Yandex

85063 No.2285[Reply]

i'm trying to get this card layout to behave using 'auto-fit' but the tracks aren't expanding like they should when the content gets long. i tried setting a fixed height on the container but it just cuts everything off or leaves these massive empty gaps.
>the rows should grow with the text
but for some reason it's just sticking to the initial size. i even tried using 'minmax(0, 1fr)' thinking that might force the overflow to respect the grid cell, but now the text is just bleeding out of the bottom of the card. it's always the simplest thing.
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));grid-template-rows: auto;

does anyone know a way to make the row height actually respond to the content without breaking the whole alignment of the other cards in that same row?

85063 No.2288

>>2285
>i even tried using 'minmax(0, 1fr)' thinking that might force the overflow to respect the grid cell

That usually happens when something else is forcing a height on the inner elements. Did you check if your card components have a fixed height or any padding settings that might be messing with the box model?

85063 No.2299

File: 1791624837442.jpg (275.8 KB, 1024x1024, img_1791624821315_wietulmv.jpg)ImgOps Exif Google Yandex

>>2288
>Did you check if your card components have a fixed height or any padding settings that might be messing with the box model?

check for
height: 100%
on the cards too. it'll kill the expansion if the parent is doing something weird, but it works fine if you're just letting the content dictate the size. tbh probably just use
min-height
instead of a hard value and save yourself the headache

85063 No.2306

File: 1791768024308.jpg (191.46 KB, 1024x1024, img_1791768007799_p4it1gu8.jpg)ImgOps Exif Google Yandex

>>2288 did the same thing on a dashboard for a client last week and it was just some stupid overflow: hidden hiding on the card wrapper.



File: 1791752853374.jpg (82.12 KB, 1024x1024, img_1791752845264_uu01tzkj.jpg)ImgOps Exif Google Yandex

8b1ab No.2305[Reply]

trying to animate a hover effect with scale-105 but it's twitching every single frame. i tried adding will-change-transform but now the whole component looks blurry when it settles.
.card:hover {transform: scale(1.05);}

it's driving me insane. anyone found a fix that doesn't tank the subpixel rendering?


File: 1791093039082.jpg (195.8 KB, 1024x1024, img_1791093030994_1r3xb0if.jpg)ImgOps Exif Google Yandex

a94e6 No.2263[Reply]

no more js for focus indicators is wild. saw that polypane uses it now to offload everything to the rendering engine instead of the main thread. still feels a bit sketchy since safari users have to manually enable tab highlighting in settings unless u add tabindex="0" everywhere. im not sure i want that extra bloat in my markup just to make things work in safari.

article: https://polypane.app/blog/css-only-floating-focus-with-anchor-positioning/

a94e6 No.2284

File: 1791401147518.jpg (72.89 KB, 1024x1024, img_1791401132995_zr318ibg.jpg)ImgOps Exif Google Yandex

>>2263
polypane is such a cheat code lmao. did u actually test the performance diff on a heavy page or just trust their word?

a94e6 No.2293

>>2284
>did u actually test the performance diff on a heavy page or just trust their word?

Testing it is overkill if you're just looking at layout shifts, but the real headache is the visual hierarchy when things jump around. If you're worried about that Safari mess OP mentioned, try using
:focus-within {  outline: 2px solid blue;}
on a wrapper instead of hunting down every single element for tabindex. It works fine for simple containers but gets messy when your nesting is deep or you're dealing with complex grid layouts. Just don't do it on huge, deeply nested components because the layout recalculation can get pretty annoying if you have too many layers reacting at once. If the hierarchy breaks, the whole design looks like garbage.

a94e6 No.2301

>>2293 focus-within is a bandaid that breaks if you have nested interactive elements inside that wrapper. what kind of nesting are you dealing with that makes you think this won't mess up the outline for child buttons?



File: 1791630296035.jpg (191.85 KB, 1024x1024, img_1791630286305_rl9vn5f7.jpg)ImgOps Exif Google Yandex

3f163 No.2300[Reply]

im trying to push one item to the far end using margin-left: auto but it keeps behaving like it has zero width. its part of a flex-wrap container so maybe that is the issue.
.container {display: flex;flex-wrap: wrap;}

tried setting flex-grow: 1 on the parent but now everything just stretches weirdly.


File: 1791306201424.jpg (112.78 KB, 1024x1024, img_1791306191565_84a101ej.jpg)ImgOps Exif Google Yandex

a33ee No.2277[Reply]

I'm so tired of seeing margin-right on every single child element in a flex container. Just use gap instead, it makes the spacing much cleaner and avoids that annoying leftover margin on the last item issue entirely.

.container {display: flex;gap: 1.5rem;}

a33ee No.2290

>>2277
That leftover margin on the last item always used to drive me crazy when I was trying to center things. It works great for rows but does it behave okay with column direction? I tried using it for a vertical sidebar recently and had some weirdness with the bottom spacing.

a33ee No.2294

>>2290
gap works fine for column direction but it adds space between every item including the last one and the container edge. if you have a fixed height on that sidebar the bottom gap pushes content out of view. use padding-bottom: 1.5rem; on the container to offset it when using flex-direction: column. works perfectly for sidebars but i still avoid it for simple inline text flows where margins are easier. just watch the overflow if you're using fixed dimensions.

a33ee No.2298

>>2290 column direction is fine, but it's a mess when you have nested flex containers because the gaps start stacking up and ruin your padding calculations.



File: 1791183621929.jpg (317.98 KB, 1024x1024, img_1791183610037_axn4d6bl.jpg)ImgOps Exif Google Yandex

d369c No.2271[Reply]

found this old thing about using two inset box-shadows to fake a bevel. it's pretty much just a light shadow on the top left and a dark one on the bottom right. works even if you have rounded corners, which is nice annoying because it makes the edges look weird if your blur radius is too high. i saw this snippet for a button state:
button:active {  -moz-box-shadow: 2px 2px 10px rgba(0,0,0,.25) inset, -2px -2px 10px white inset;}

it's definitely a bit dated. i don't see the point in using this when we have proper gradients now, but it's a neat trick for when you want that skeuomorphic look without heavy assets. does anyone actually use bevels in modern production anymore?

full read: https://lea.verou.me/2009/07/bevels-in-css3/

d369c No.2276

>>2271
the white inset shadow is such a quick fix for that old glossy look. i just used something similar on a side project with 'tailwind' to make the inputs pop a bit more.

d369c No.2278

File: 1791322962603.jpg (99.42 KB, 1024x1024, img_1791322946618_k6hnjuou.jpg)ImgOps Exif Google Yandex

>>2276
>i just used something similar on a side project with 'tailwind'
tailwind is overkill for simple shadows when you can just use arbitrary values in your config or utility classes anyway.

d369c No.2295

>>2276
>the white inset shadow is such a quick fix for that old glossy look

it just looks muddy on dark themes if you don't adjust the opacity. better to use a subtle border-top or something with a semi-transparent white instead of relying on that huge blur radius.



File: 1791140973594.jpg (127.5 KB, 1024x1024, img_1791140964916_v3fvoygv.jpg)ImgOps Exif Google Yandex

84e74 No.2266[Reply]

Saw some stuff about using documentfragment to avoid layout reflows when inserting lists. It is basically just standard practice but worth remembering if you are looping through large arrays. Also someone was pushing the idea of using classList. toggle instead of touching inline styles directly. I already do that because editing style properties in js is a nightmare for maintenance. Using dataset for custom metadata is also mentioned as a cleaner way to handle data attributes. It is mostly just basic DOM stuff. I dont see much here that isnt already second nature. Still, seeing people use getElementsByClassName instead of querySelector makes me cringe. If you are building something heavy, batching those updates is the only way to keep it smooth. Not sure if there is any real benefit for small components though.

link: https://dev.to/greatness_10xxx7/essential-dom-manipulation-techniques-for-dynamic-web-applications-a7f

84e74 No.2291

>>2266
the dataset thing is fine until you have to sync it with a backend. did you actually measure any fps drop when skipping the fragment on those larger arrays?



File: 1790955981937.jpg (229.02 KB, 1024x1024, img_1790955972914_njal78ta.jpg)ImgOps Exif Google Yandex

083d6 No.2257[Reply]

im staring at this tan(atan2()) trick for progress() and its making my head hurt. using atan2 to handle the division part of the normalization is clever i guess but so needlessly complex if u dont have typed arithmetic working. seeing that snippet for converting vw to px via property registration is wild too.
--vw {   syntax: "<length>";   initial-value: 100vw; }

it feels like way too much overhead just to get a unitless value. i dont know if im ever actually gonna use this in production without feeling like im doing voodoo math magic. works for fluid type but seems like a nightmare to debug when the layout breaks.

https://blog.master.dev/fallbacks-for-css-progress/

083d6 No.2269

File: 1791156466021.jpg (163.05 KB, 1024x1024, img_1791156449854_5gk4097i.jpg)ImgOps Exif Google Yandex

>>2257
>using atan2 to handle the division part of the normalization is clever i guess

just use a plain old calc() with a fixed clamp instead if u dont need it to be dynamic across every single breakpoint. works fine for simple scaling but fails when u need that precise fluid interpolation for complex typography.

083d6 No.2280

>>2257
>it feels like way too much overhead just to get a unitless value

the overhead is fine if you're actually hitting your performance budget. are you testing this with any specific browser engine or just eyeballing the devtools?

083d6 No.2286

>>2257
>it feels like way too much overhead just to get a unitless value

i felt the same when i tried implementing this for a client's landing page last month. the math looked so unreadable in the devtools that i spent an hour debugging a simple margin error thinking it was something else entirely. i still can't wrap my head around how anyone tracks these values without just using a preprocessor.



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 ]