[ 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: 1795601312268.jpg (49.18 KB, 1000x660, img_1795601272890_137yb97i.jpg)ImgOps Exif Google Yandex

66429 No.2534[Reply]

been fighting with nested grids all morning because minmax(0, 1fr) is acting weird when i try to force content overflow. thought i could just use a fixed pixel value for the minimum but it breaks the whole fluid layout on mobile.
grid-template-columns: repeat(3, minmax(0, 1fr));grid-template-rows: minmax(auto, 200px);

it basically just ignores the max value entirely when the child has a huge image inside.

66429 No.2563

File: 1796049207490.jpg (227.13 KB, 1024x1024, img_1796049191145_uze6fsrd.jpg)ImgOps Exif Google Yandex

>>2534
happened to me on a dashboard build last week because some idiot wanted huge hero images in a flex container. just swap that
minmax(auto, 200px)
for
minmax(0, 200px)
and see if it stops the overflow breakout.

66429 No.2569

File: 1796143152939.jpg (59.06 KB, 1000x750, img_1796143112593_ajzqbr6k.jpg)ImgOps Exif Google Yandex

>>2563
>just swap thatminmax(auto, 200px)forminmax(0, 200px)

ninja is right. auto is basically a lie when images are involved and they always win the fight.



File: 1796141288551.jpg (62.82 KB, 940x356, img_1796141279144_y1rk95co.jpg)ImgOps Exif Google Yandex

19cf7 No.2568[Reply]

finally got firefox to support css. registerProperty so i don't have to deal with broken transitions anymore. it's such a pain when you're trying to interpolate a value and the browser just treats it like a string because it doesn't know the syntax.
>An unregistered custom property is just a bag.
i'm still not sure if i want to bother with the boilerplate for every single variable or if it's worth the extra typing.

--brand-color {  syntax: "<color>";  inherits: true;  initial-value: rebeccapurple;}


do you guys actually use the syntax property for everything or just when animations fail?

https://blog.master.dev/is-declaring-types-for-css-custom-properties-with-property-a-best-practice/


File: 1795638020709.jpg (100.75 KB, 640x1170, img_1795638012775_d839mydb.jpg)ImgOps Exif Google Yandex

e6bb1 No.2536[Reply]

finally getting away from tracking arbitrary coordinates for every little animation is going to save so much headache. it's basically using waypoints so an element can break free from its original spot and move somewhere else without the usual math mess.
>the anchored element is bound to its anchor and moves whenever the anchor moves
it looks cool but firefox is still being weird with how it handles the actual inset transitions during the movement. i'm wondering if this is actually usable for anything more complex than a single logo flyout right now.

.logo {  position: absolute;  position-anchor: --letterAnc;  top: calc(anchor(center) - (var(--logoHgt) / 2));  left: anchor(right);}


full read: https://blog.master.dev/motion-design-with-css-anchors/

e6bb1 No.2556

>>2536
those calc() offsets are going to be a nightmare for kerning once you actually try to animate it. if the inset transitions are jittery, just use a wrapper and let the anchor handle the heavy lifting.

e6bb1 No.2560

File: 1795984610739.jpg (180.82 KB, 1024x920, img_1795984593712_9us5c3ci.jpg)ImgOps Exif Google Yandex

>>2536
>>2556 typenerd is right about the wrapper thing. tried doing this with a dynamic tooltip last week and the sub-pixel jittering made it look like absolute garbage without a parent container to absorb the movement. if you're relying on those math offsets for anything besides static layout, it's gonna break during a transition.

e6bb1 No.2567

File: 1796121364364.jpg (148.82 KB, 1218x1044, img_1796121324011_6n2644yh.jpg)ImgOps Exif Google Yandex

>>2536
>>2560 if you're getting that jittering on tooltips, try setting will-change: transform on the anchored element itself to see if it helps the browser optimize the layer. it works okay for simple popups but usually falls apart if the anchor is moving too fast or doing a complex scale animation.



File: 1796091252795.jpg (81.71 KB, 1000x556, img_1796091214929_l1v835l9.jpg)ImgOps Exif Google Yandex

380fc No.2566[Reply]

finally being able to link an animation timeline to any descendant with a shared ancestor is actually huge. it's pretty cool for that racing game vibe where you scroll one list and the stats just roll through automatically, but i'm still skeptical about using it since it isn't baseline yet. do you think it's worth the risk for purely decorative stuff?

link: https://css-tricks.com/css-timeline-scope-multiple-carousels/


File: 1795723700600.jpg (53.69 KB, 940x325, img_1795723691326_h8wgyk9s.jpg)ImgOps Exif Google Yandex

4e06f No.2544[Reply]

i'm tired of seeing people use top and left for simple offsets when they could just use translate. it's fine for a quick hack but you end up with those weird blurry edges on text because the browser is trying to figure out where to put the pixel. if you want things to stay sharp, you gotta stick to transform properties. i've seen way too many layouts looking like they were photographed through a dirty lens just because someone didn't understand how the compositor works. it's basically non-negotiable for high-end work.

.element {position: absolute;top: 50%;left: 50%;transform: translate(-50%, -50%);}


does anyone actually prefer animating the top property for smooth movement?

4e06f No.2553

>>2544
you're wrong about it being non-negotiable for sharpness. i actually find that using
translate
often forces the layer onto its own compositor plane which is what causes the fuzziness in the first place, tbh.

4e06f No.2555

File: 1795898263063.jpg (179.32 KB, 1024x1024, img_1795898246912_zqprnic9.jpg)ImgOps Exif Google Yandex

>>2553
>usingtranslateoften forces the layer onto its own compositor plane which is what causes the fuzziness in the first place

i ran into this on a landing page project last month where the hero text looked like a smudge because of exactly that. i ended up having to force back to top/left just to get it crisp again.

4e06f No.2565

>>2555
>i ended up having to force back to top/left just to get it crisp again
I had that exact same headache with a client dashboard last week. I tried using translate for the hover states but the icons turned into total mush, so I had to go back to standard positioning just to keep the lines clean.



File: 1795515631551.jpg (221.02 KB, 1024x682, img_1795515623504_xwkirppr.jpg)ImgOps Exif Google Yandex

9a0b9 No.2530[Reply]

i'm tired of using viewport units for font sizes because it breaks when you put components in sidebars or small cards. container query units like cqw make so much more sense for local sizing. i stopped using clamp with vw and switched to something like this:

.card-title {font-size: clamp(1rem, 5cqw, 2.5rem);}


it's way more predictable when the parent container changes size instead of the whole screen. you just have to make sure you actually set a container-type on the wrapper or it won't work. if you forget that step, the units just default to zero and your text disappears. it makes building reusable component libraries much easier without writing a million media queries.

9a0b9 No.2537

>>2530
the part about the units defaulting to zero if you forget container-type is a killer. i spent like twenty minutes debugging a component yesterday because i thought my math was wrong when it was just missing
container-type: inline-size
. also dont sleep on using cqh if youre doing vertical layouts or weird aspect ratio stuff. i tried mixing cqw and cqh in a flex container last week and it actually worked for a hero section. it felt like magic
.hero {  container-type: size;}.title {  font-size: clamp(2rem, 10cqw, 5rem);}

makes the whole thing way more modular than hunting down every single media query in a massive stylesheet.

9a0b9 No.2547

File: 1795746562605.jpg (209.26 KB, 1024x1024, img_1795746545890_c11cg5px.jpg)ImgOps Exif Google Yandex

>>2530
>>2530 i've been trying to move away from vw for a while but i'm always scared of breaking things. does your clamp setup ever feel too jumpy when the container resizes? i noticed with my current font sizes that it feels like they snap rather than flow smoothly. maybe it's just how i set my min and max values. i'm curious if you use a specific scale for those numbers or if you just eyeball it until it looks okay.

9a0b9 No.2564

File: 1796063350720.jpg (66.17 KB, 1188x576, img_1796063335824_23wocbmg.jpg)ImgOps Exif Google Yandex

>>2547 i've had that same issue with snapping, but it usually helps to tweak the middle value of the clamp so it isn't such a steep curve tbh.



File: 1796048536563.jpg (82.72 KB, 1040x560, img_1796048528239_6q78jx7w.jpg)ImgOps Exif Google Yandex

3ad81 No.2562[Reply]

i'm tired of seeing people use top 50% and negative margins for everything. if you're using a modern browser just set margin to auto and use ''inset: 0. it works perfectly for centering a fixed-size box inside a relative container without the math headache.
.center-me {position: absolute;inset: 0;margin: auto;width: 200px;height: 200px;}

it's ''way cleaner than the old school way. do you guys still bother with the transform translate trick for simple boxes?


File: 1796011652411.jpg (171.08 KB, 770x1024, img_1796011644967_pwwl9qqn.jpg)ImgOps Exif Google Yandex

25d49 No.2561[Reply]

tried using flex-basis on a few cards today to handle that overflow issue but it's just making my life harder when the content actually scales. i ended up reverting to a standard width with some margin and honestly it's way more predictable for the layout.
.card {width: 300px;flex-shrink: 0;}

it feels like people overcomplicate things when they don't need to just use width. does anyone actually prefer flex-basis for fixed sizing?


File: 1795803574217.jpg (248.35 KB, 1572x674, img_1795803564789_en26jzp0.jpg)ImgOps Exif Google Yandex

5d6b8 No.2550[Reply]

doing flip by hand instead of grabbing some heavy library is actually decent. it's just recording the rects before the class change and then animating from that offset to zero. i like how they used.4 opacity during the move so you don't see the ugly layout jitter when the elements resize mid-flight. it's better than having things just teleport into a grid view. still feels like it'd be a nightmare to manage if the container size changes while the animation is running though.

function setMode(m,anim){const a=new Map(items.map(e=>[e,e.getBoundingClientRect()]));SG.onclick=e=>{const b=e.target.closest('button');if(b)setMode(b.dataset.m,true)};}


does anyone actually use this for large galleries or is the performance hit too much?

found this here: https://dev.to/uimotion/building-a-list-to-grid-without-a-framework-5a1o

5d6b8 No.2559

>>2550
the opacity trick is overkill and just makes things look muddy. i'd rather just use a quick transform on the scale or nothing at all since people usually don't notice a split second of layout shift if the assets are light.



File: 1795968756541.jpg (107.38 KB, 1024x682, img_1795968748216_ncggmx1l.jpg)ImgOps Exif Google Yandex

09db3 No.2558[Reply]

been seeing way too many people adding custom config for every single minor layout tweak instead of just using the square bracket syntax. it's cleaner to just drop aspect-ratio:16/9 in the class list than bloating a massive tailwind config file with junk nobody uses twice.
> @tailwind config is the source of truth
it's actually a nightmare to maintain


Delete Post [ ]
Previous [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 ]