logoalt Hacker News

Small, native web tricks worth remembering

181 pointsby marcomezzavillatoday at 9:45 AM49 commentsview on HN

Comments

m-s-ytoday at 1:47 PM

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.

moonteartoday at 10:28 AM

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.

show 1 reply
zeroqtoday at 4:26 PM

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."

  const input = {
  finePointer: matchMedia('(any-pointer: fine)').matches,
  coarsePointer: matchMedia('(any-pointer: coarse)').matches,
  canHover: matchMedia('(any-hover: hover)').matches,
  }; 
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.
show 2 replies
apples_orangestoday at 10:40 AM

please don't hide scrollbars :)

show 3 replies
herrherrmanntoday at 12:44 PM

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.

show 2 replies
mceachentoday at 2:00 PM

"... that matters" is the new emdash

show 1 reply
tyleriustoday at 11:50 AM

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).

show 1 reply
OuterValetoday at 10:13 AM

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.

show 2 replies
qqruntoday at 3:53 PM

Thank you for sharing, it's very helpful.

nater5000today at 2:48 PM

I'm not sure where the design for this site came from, but I hate that it brings you to a new page to show you something that could have probably fit in the big ass buttons on the first page lol. It took my by surprise the the card didn't flip over to show you the details and instead just navigated to a new page. I'm not a design guy- more of a backend, do everything in a TUI kind of guy- so if I'm caught off guard by a cheap UI/UX decision, then that's a serious problem.

show 2 replies
hk__2today at 10:37 AM

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

show 1 reply
andaitoday at 2:28 PM

What does native mean in this context?

show 1 reply
mrbluecoattoday at 1:01 PM

I'm always googling how to center with CSS.. bookmarked.

zuzululutoday at 4:25 PM

what would be cool is an llms.txt that i can feed to use these as most try to use React when they could just use html

markuswagnertoday at 12:53 PM

Super neat! Rare to see a genuinly actually useful opinionated list like this.

JodieBeniteztoday at 1:20 PM

Nice tips there ! :)

vortegnetoday at 11:52 AM

without demos this is mostly useless i think

ChrisArchitecttoday at 1:55 PM

Not to be confused with https://http.cat/

show 2 replies
robertoandredtoday at 3:08 PM

And yet that site has horizontal scroll bars.

jobuildsstufftoday at 1:49 PM

[flagged]

noobplustoday at 12:49 PM

[dead]

hn9rsvy2gxtoday at 12:31 PM

[dead]

hn5xz7plcjtoday at 12:02 PM

[dead]

hndhyc0bdttoday at 2:28 PM

[flagged]