[ 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: 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.



File: 1791056225948.jpg (258.5 KB, 1024x1024, img_1791056218437_vj44i3bt.jpg)ImgOps Exif Google Yandex

a3660 No.2261[Reply]

finally figured out how to check if things are overlapping without writing a massive intersection observer mess.
>Detect when elements overlap with CSS
it's honestly about time wild that we can do this natively now, but i'm still skeptical about how it'll perform on huge layouts with tons of moving parts.

https://piccalil.li/the-index/200/?ref=main-rss-feed

a3660 No.2274

>>2261
>it's honestly about time wild that we can do this natively now

did u test it with hundreds of nodes or just a simple grid? im worried about the paint cost if everything is animating at once.

a3660 No.2281

>>2274
>im worried about the paint cost if everything is animating at once
paint isn't even the main bottleneck here. browser engines are already doing this math for every single frame during a transform anyway, so it's basically free work. just don't go putting it on 5000 nested divs or you'll hit a wall lol. the real killer is the layout recalculation

a3660 No.2282

File: 1791378902735.jpg (198.41 KB, 1024x1024, img_1791378887560_8b4tpp1k.jpg)ImgOps Exif Google Yandex

>>2274
>im worried about the paint cost if everything is animating at once
growth is right, engine's already doing the math for transforms. op, did you actually run a benchmarking script on a heavy viewport or just test it on your single div?



File: 1791342849828.jpg (104.29 KB, 1024x1024, img_1791342841369_dyhp2r3o.jpg)ImgOps Exif Google Yandex

6aeb2 No.2279[Reply]

been wrestling with the default container behavior all morning. it's so annoying when you want that standard gutter but tailwind just leaves the edges raw on mobile. i tried using the padding utility on every single page but then i realized i'm basically duplicating rewriting the same classes everywhere. i ended up messing with the theme config to add some default horizontal padding directly into the container class. it's a bit of a hack because it makes the centering look weird if you aren't careful with the max-width.
theme: {container: {center: true,padding: '2rem',},}

now my nested components are behaving much better though. i also stumbled onto this cool trick using CSS variables to sync the container padding with my main layout margin so everything stays perfectly aligned without extra math. it's a total lifesaver for keeping the rhythm consistent across different viewports. definitely worth a look if you're tired of adding px-4 or px-6 to every single div in your project.


File: 1791263172872.jpg (161.35 KB, 1024x1024, img_1791263165266_82zt7rlz.jpg)ImgOps Exif Google Yandex

5847b No.2275[Reply]

i'm tired of seeing people treat tailwind like it's magic. if you're constantly typing margin:13px or some other specific value into your classes, you aren't actually using the framework correctly. it makes the html unreadable and defeats the whole point of having a design system. just add it to the theme config once.
theme: {extend: {spacing: {'13': '13px',}}}

it's pure laziness at this point. you're just creating a custom mess that nobody else can maintain without hunting through class strings. anyone else seeing these massive single-line divs in every repo lately?


File: 1791220437875.jpg (130.98 KB, 1024x1024, img_1791220428648_59g82jmq.jpg)ImgOps Exif Google Yandex

bb77b No.2273[Reply]

i'm tired of seeing everyone just use 1fr for everything like it's some magic fix. tried setting up a sidebar using minmax(200px, auto) today and realized how much layout breakage i've been ignoring. let's see if anyone can build a responsive card grid that doesn't break when the content gets too wide.


File: 1790870602308.jpg (199.91 KB, 1024x1024, img_1790870592484_sf3ywkvv.jpg)ImgOps Exif Google Yandex

b411f No.2252[Reply]

been thinking about that old hack where you set font-size to 0 just to kill the gaps between inline-blocks. it's so annoying to maintain. seeing white-space-collapse: discard mentioned as a future thing makes me wonder if we can actually stop messing with margin behavior and negative margins for every little layout tweak. i'm still struggling with finding the offset parent when things get nested too deep. honestly, the whole normal flow stuff is such a headache once you start adding absolute positioning into the mix. does anyone actually use the font-size: 0 trick anymore or is it just dead?

more here: https://polypane.app/blog/understanding-the-fundamentals-of-css-layout/

b411f No.2265

>>2252
>does anyone actually use the font-size: 0 trick anymore or is it just dead?

I still find myself reaching for it when I'm dealing with some legacy legacy branding guidelines that force me to use specific inline elements. It's a total nightmare when you realize the spacing is ruining your kerning because of those tiny gaps.
it's basically a crime against typography

b411f No.2270

>>2265 crime against typography is an understatement. i had to use it last week on a client site because they insisted on using old school tags for every single icon and the spacing was driving me insane. zero font size kills your accessibility too if you arent careful with screen readers.

b411f No.2272

File: 1791198891535.jpg (146.08 KB, 1024x1024, img_1791198875292_8kztzlzn.jpg)ImgOps Exif Google Yandex

>>2265
>It's basically a crime against typography
The kerning issues are the worst part. I usually just switch to flexbox or grid for those components, but it's hard when you're stuck with a template that uses nested spans everywhere. I hate legacy code



File: 1790588817228.jpg (107.89 KB, 1024x1024, img_1790588809009_02lus2w9.jpg)ImgOps Exif Google Yandex

d0a91 No.2233[Reply]

finally found a way to stop those embedded pens from being invisible when tabbing through. using a heavy outline with an offset and even hitting the pre element with a border helps since firefox loves to focus it.
>button:focus, a:focus {
/Highlighting on focus/
outline: 5px solid #f23c50;

outline-offset: 2px;

transform: rotate(0);

}
it's kind of a hacky workaround though. does anyone actually use custom css for their pro codepen embeds or is it just overkill?

full read: https://www.matuzo.at/blog/improving-the-keyboard-accessibility-of-codepen-embeds

d0a91 No.2253

>>2233
>hitting the pre element with a border helps since firefox loves to focus it

That Firefox behavior is such a headache for accessibility. I ended up just wrapping my embeds in a custom div container with its own box-shadow because trying to target the internal iframe elements gets way too messy when the embed updates.

d0a91 No.2268

>>2253
>trying to target the internal iframe elements gets way too messy
did you use box-shadow on the wrapper or just a standard border?



File: 1790668360186.jpg (233.78 KB, 1024x1024, img_1790668351848_zjnbm9ab.jpg)ImgOps Exif Google Yandex

cf895 No.2238[Reply]

it's such a headache trying to figure out if properties actually work together since checking display flex and gap separately just tells you they're parseable without confirming the actual effect. i wonder if using named-feature will actually stop us from having to write those weird hacks for when implementations overlap.

article: https://www.bram.us/2026/08/27/feature-detecting-undetectable-css-features-with-supports-named-feature/

cf895 No.2267

File: 1791149380125.jpg (150.88 KB, 1024x1024, img_1791149362937_me0rk14p.jpg)ImgOps Exif Google Yandex

>>2238
i spent three hours debugging a grid layout for a client last week because i assumed gap was behaving fine on an older browser version. named-feature would have saved me from that entire mess.



File: 1790747864124.jpg (316.69 KB, 1024x1024, img_1790747854450_c28sykpn.jpg)ImgOps Exif Google Yandex

68ea9 No.2243[Reply]

been thinking way too much about how easy it is to mess up semantics when using grid. i was just messing around with some new layouts and realized how quickly you can totally break the tab order if you start playing with visual placement. it's such a trap for accessibility, especially since we're so used to just letting the browser handle things. definitely makes me second-guess my more complex templates.

https://www.matuzo.at/blog/the-dark-side-of-the-grid

68ea9 No.2264

>>2243
>how quickly you can totally break the tab order
i did this on a sidebar redesign last month and completely forgot that moving the nav via grid-area doesn't change where the focus goes in the source code.



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 ]