Join the discussion
Write your take first — we'll ask for email only when you're ready to publish.
- Hacker News
- Super neat! Rare to see a genuinly actually useful opinionated list like this.by markuswagner
- Nothing AI can not fix and add demos in less than a minute for less than a centby Kuyawa
- without demos this is mostly useless i thinkby vortegne
- "... that matters" is the new emdashby mceachen
- Not AI, just not a native speaker.
- > Each post-it pairs one useful platform feature with a small example
I can’t find a single example; each post-it just shows some code but not the result of it.
by hk__2 - The code is the example. "Demo" is probably a better word for what you're thinking of.
- Best resource for proper HTML+CSS development is Jason Knight AKA deathshadow's CUTCODEDOWN (cutcodedown.com at Web archive) and his articles at Medium and CodePen (user Jason Knight).by tylerius
- How is an archived web site supposed to be a good resource on modern html and css development exactly?by yurishimo
- Neat! I like these opinionated lists, especially when it’s easy to browse and cherry-pick useful stuff. It’d be very good to mention how compatible the features are, though. Especially with newer CSS features, it’s easy to overestimate how ready they are for all browsers.
For that, there could just be links to the related MDN and/or caniuse.com pages.
by herrherrmann - Yes. MDN and caniuse.com are great. See also https://webstatus.dev and https://web.dev/baselineby chrisweekly
- They're not really 'tricks' as much of mentions of assorted features of HTML and CSS. You get to discover a similar assortment of things (with much more immediately available detail and many examples) just clicking around MDN.by OuterVale
- That’s fair, "tricks" may be overselling it. The website is meant to be a small, opinionated collection of features I want to remember, not a replacement for an authoritative reference like MDN. I can probably make that positioning clearer.
- What's the difference?by markuswagner
- Sure, they're not "tricks", but it's also definitely not the same as what you get randomly browsing formal documentation.
- Maybe it's just me, but it seems like a huge waste of time (or to be on a more positive note - potential).
Just the first example "Device type in JS".
"A coarse pointer does not mean “mobile”, and a fine pointer does not guarantee “desktop”. Ask the browser about input capabilities instead of guessing the device from its user agent."
So it doesn't tell me how to identify device type. It doesn't even run the code so I could quickly compare results between my mobile and desktop devices to establish a baseline.const input = { finePointer: matchMedia('(any-pointer: fine)').matches, coarsePointer: matchMedia('(any-pointer: coarse)').matches, canHover: matchMedia('(any-hover: hover)').matches, };by zeroq - It has all the hallmarks of just telling an agent to scrape MDN and make a websiteby wonnage
- You’re right: it doesn’t identify the device type, so the title is misleading.
The intended point is that device type is often the wrong thing to detect: a touchscreen laptop may expose both coarse and fine pointers, while a tablet may be connected to a mouse or trackpad. The snippet detects available input capabilities instead, which is usually what the interface should respond to.
I wasn’t particularly careful with the titles, but this one should be "Detect input capabilities". Thanks for the heads-up!
- The conclusion is wrong. The point of using these media queries is that:
1) You can only use tiny buttons with precise pointers.
2) You can only use hover popups with pointers that can actually hover.
In practice, much of this is too much work and everyone just designs for touchscreens instead. It's rare to find a website that even bothers with using title="" for tooltips because smartphones are a disaster of UI and lack tooltips.
by AlienRobot - please don't hide scrollbars :)
- Only time I've seen that work is when making a carousel. Once you're using scroll snap it's already not going to behave the way you'd expect a scrollable container to, so having a different indicator doesn't feel so egregious to me.by afavour
- If you mean the "Hide scrollbars" note, I agree 100% (:
There are a few specific situations where it can be useful, but I added the caveat precisely because it’s generally not a good practice.
- Yeah, that was the first one my eyes went to. The only scenarios I can think of where it is acceptable to hide scrollbars are infinite canvases where you’ll draw your own non-linear ones (and even then be disappointed because they can’t look or behave natively), and things like maps where you remap scrolling to zoom and might want to use a backing invisible scroll area for that rather than consuming scroll events (which are somewhat more limited).
In short: unless the native scroll bar will be wrong, do not under any circumstances hide it.
by chrismorgan - There are some good descriptions and hints, but what the site really needs is examples. Just looking at the code doesn't help me much. The descriptions are also mostly so short, that they could just as well be tooltips on the homepage. The whole premise of the page is a collection of "web tricks worth remembering" and I can't fathom what bash (e.g. `du -hd 1 . | sort -hr`) is doing there.by moontear
- You’re absolutely right, thanks for the feedback. I initially included live examples (mostly through CodePen), but they were taking too much time to maintain, so I stopped.
The Bash entry was really just a half-finished personal note that I never properly edited. It’s probably out of scope too.
- fwiw I find `*` a lot easier in regular use than all of `-d 1 .`. It doesn't automatically expand to dotfiles but for regular typing, this advice looks like something you'd do if you're a robot or making an aliasby Aachen
- Love when I go into a car dealership and get to read all about the different cars. Specially when the cars aren’t actually there. In fact there’s not even a picture of a single car. Yep that’s my jam.by m-s-y
- I agree 100%. Pictures or any sort of visual representation of any kind would only diminish the quality of the whole experience.
The fact is, if you're smart enough you can just eyeball raw css and just see it if you close your eyes.
Oh you're not also gifted? Well I guess you're not special enough for this job then. Maybe you should be flipping burgers instead.
/s
- If only there was a way to render this syntax in the browser.by HenriTEL