[ 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: 1791673159600.jpg (171.06 KB, 1024x1024, img_1791673150746_te61uu1r.jpg)ImgOps Exif Google Yandex

d3469 No.2302[Reply]

it's basically just writing inline styles but with more friction. if you're doing this for something that isn't a one-off hack, you're making the config unreadable.
>
text-[#f0f0f0]mt-[13px]

don't call it utility-first when it's just magic numbers scattered everywhere. anyone else just giving up and using plain css for anything complex?

d3469 No.2313

>>2302
The magic numbers aren't the problem if you actually define a design system for them first. I'm fine with arbitrary values when I'm just tweaking a margin, but anything that needs to be consistent should definitely be in the theme config.

d3469 No.2320

File: 1791941465012.jpg (280.88 KB, 1024x1024, img_1791941449359_yzh4nbtj.jpg)ImgOps Exif Google Yandex

>>2302
I had this same meltdown on a landing page last week because the designer sent over a Figma file with totally random pixel values for every single padding. I tried using Tailwind Config to map them all but it was just a nightmare of renaming variables. Ended up just sticking to some standard classes and letting the edges be slightly off spoilerit actually looks better

d3469 No.2321

>>2320 I wouldn't just let the edges be off, you should probably just use a global CSS file for those weird padding values so they at least stay consistent across the whole site. the designer will never notice anyway



File: 1791507938847.jpg (188.52 KB, 1024x1024, img_1791507929984_0x4xdjh0.jpg)ImgOps Exif Google Yandex

a9781 No.2289[Reply]

was trying to dynamically build a class name using a loop but forgot that you can't just drop the variable in there without the #{} syntax. it's so easy to mess up when you're rushing through a stylesheet. honestly just use css variables if you don't want to deal with this nonsense
.theme-#{$color} {background: $color;}

tbh the compiler errors are way too vague about where the interpolation failed

a9781 No.2307

>>2289
>just use css variables if you don't want to deal with this nonsense

I spent two hours debugging a broken grid layout on a client project last week because I missed that exact syntax in a nested loop. Everything looked fine until the build failed and gave me some garbage error about an undefined property. It's such a total time sink when you're just trying to finish a quick component.
I ended up deleting the whole scss file and rewriting it in plain css

a9781 No.2309

File: 1791797242196.jpg (194.9 KB, 1024x1024, img_1791797227363_7s7amul0.jpg)ImgOps Exif Google Yandex

>>2307
>Everything looked fine until the build failed and gave me a garbage error about an undefined property.

sass errors are basically just vague riddles __designed to ruin your afternoon_

a9781 No.2318

File: 1791927487169.jpg (168.25 KB, 1024x1024, img_1791927471611_tfhmk5u4.jpg)ImgOps Exif Google Yandex

>>2309
They really are. I still find myself staring at a screen for ten minutes wondering why my loop is suddenly broken.



File: 1791465352298.jpg (153.97 KB, 1024x1024, img_1791465343089_xdlcuq7w.jpg)ImgOps Exif Google Yandex

6458f No.2287[Reply]

been messing with some nested color themes and realized i'm just wasting time manually digging through maps when i could use a simple loop to flatten them into utility classes instead of using 'map-get' every single time. it's way easier to just iterate once and generate the whole set at the start of my build.
@each $name, $color in $theme {.text-#{$name} {color: $color;}}

makes the actual component files so much cleaner without all that bloat extra logic **and i stopped forgetting my map keys

6458f No.2303

File: 1791703776665.jpg (278.15 KB, 1024x1024, img_1791703760575_me8jytng.jpg)ImgOps Exif Google Yandex

>>2287
I did this exact same thing on a huge branding project last month because my client kept changing their primary brand colors every week. Manually updating map-get calls across fifty different component files was driving me insane and making the stylesheets look like total garbage. Now I just let the loop handle the heavy lifting so I can focus on fixing the kerning in the headers instead of debugging broken variable names.

6458f No.2317

>>2303
>Manually updating map-get calls across fifty different component files was driving me insane
died a little watching you struggle with that. just use css variables and call it a day.



File: 1791385696648.jpg (160.93 KB, 1024x1024, img_1791385688772_j31287a1.jpg)ImgOps Exif Google Yandex

76490 No.2283[Reply]

tried to use aspect-ratio: 1/1 on some flex items today and it just nuked the height of everything in the container. works fine when they're in a grid but flexbox behaves like it's from 2010 whenever you try to be clever. honestly just use grid if you want things to actually behave.
at least we have overflow: hidden to hide the mess

76490 No.2297

File: 1791588228262.jpg (249.87 KB, 1024x1024, img_1791588212139_3kk1gmz0.jpg)ImgOps Exif Google Yandex

>>2283
>works fine when they're in a grid

Did you check if you have any flex-basis or min-height settings interfering with the calculation? I've seen it happen when someone forgets that flex items default to auto and just stretch everything into a mess.

it's always the min-height for me

76490 No.2316

>>2297
>I've seen it happen when someone forgets that flex items default to auto and just stretch everything into a mess.

The default stretch is usually fine, but the real headache is usually
min-width: 0
on those items. I just ran into this while messing with some new card components and they kept expanding past their container boundaries until I fixed it. it's always that one missing property



File: 1791918372360.jpg (209.11 KB, 1024x1024, img_1791918365219_x02vsiol.jpg)ImgOps Exif Google Yandex

b507a No.2315[Reply]

>Developers had muted it.

im tired of seeing devs ignore security risks because some bot is busy arguing about variable names. if the thing isnt checking for sql injection or flagging missing tests on hot paths, its basically useless noise. im skeptical about how much context you actually need to feed a prompt before it starts hallucinating style preferences again.

article: https://dev.to/ayraix/ai-code-review-that-actually-helps-instead-of-nitpicking-506i


File: 1791550776651.jpg (170.64 KB, 1024x1024, img_1791550767579_sj3ze1ha.jpg)ImgOps Exif Google Yandex

b2200 No.2292[Reply]

i've stopped using separate borders for that pressed look on buttons. it's way cleaner to just use an inset shadow with a tiny offset instead of messing with border-width or padding.
>it looks so much smoother

box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);


makes the element feel flat tactile without adding extra pixels to the layout box. does anyone else still bother with borders for this?

b2200 No.2314

>>2292
>it looks so much smoother

Totally agree on that smoothness. Borders always mess with my box-sizing calculations and it's such a headache when things shift by a pixel. I started stacking a tiny white inset shadow on top of the dark one to simulate a highlight on the edge. It makes the button look almost 3D without any heavy lifting. Just tried this:
box-shadow:   inset 0 2px 4px rgba(0,0,0,0.2),  inset 0 -1px 0 rgba(255,255,255,0.1);

Adds a bit of specular highlight to the bottom edge. Just gotta be careful with too many layers or the colors start getting muddy and weird.



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?


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 ]