frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Don't forget these tags to make HTML work like you expect

https://blog.jim-nielsen.com/2025/dont-forget-these-html-tags/
128•FromTheArchives•4h ago

Comments

theandrewbailey•3h ago
I often reach for the HTML5 boilerplate for things like this:

https://github.com/h5bp/html5-boilerplate/blob/main/dist/ind...

xg15•2h ago
There is some irony in then-Facebook's proprietary metadata lines being in there (the "og:..." lines). Now with their name being "Meta", it looks even more proprietary than before.

Maybe the name was never about the Metaverse at all...

zelphirkalt•1h ago
Are they proprietary? How? Isn't open graph a standard and widely implemented by many parties, including many open source softwares?
FoxBJK•1h ago
They're not, at all. It was invented by Facebook, but it's literally just a few lines of metadata that applications can choose to read if they want.
kaoD•1h ago
Being invented by $company does preclude it from being a standard.

https://en.wikipedia.org/wiki/Technical_standard

> A technical standard may be developed privately or unilaterally, for example by a corporation, regulatory body, military, etc.

PDF is now an international standard (ISO 32000) but it was invented by Adobe. HTML was invented at the CERN and is now controlled by W3C (a private consortium). OpenGL was created by SGI and me maintained by the Khronos Group.

All had different "ownership" paths and yet I'd say all of them are standards.

fud101•1h ago
how do you find this when you need it?
chrismorgan•2h ago
> <html lange="en">

s/lange/lang/

> <meta name="viewport" content="width=device-width,initial-scale=1.0">

Don’t need the “.0”. In fact, the atrocious incomplete spec of this stuff <https://www.w3.org/TR/css-viewport-1/> specifies using strtod to parse the number, which is locale dependent, so in theory on a locale that uses a different decimal separator (e.g. French), the “.0” will be ignored.

I have yet to test whether <meta name="viewport" content="width=device-width,initial-scale=1.5"> misbehaves (parsing as 1 instead of 1½) with LC_NUMERIC=fr_FR.UTF-8 on any user agents.

cousin_it•1h ago
Wow. This reminds me of Google Sheets formulas, where function parameters are separated with , or ; depending on locale.
noja•1h ago
Same as Excel and LibreOffice surely?
KoolKat23•1h ago
Yes
troupo•1h ago
The behaviour predates Google Sheets and likely comes from Excel (whose behavior Sheets emulate/reverse engineer in many places). And I wouldn't be surprised if Excel got it from Lotus.
Moru•1h ago
Not to mention the functions are also translated to the other language. I think both these are the fault of Excel to be honest. I had this problem long before Google came around.

And it's really irritating when you have the computer read something out to you that contains numbers. 53.1 km reads like you expect but 53,1 km becomes "fifty-three (long pause) one kilometer".

cubefox•53m ago
> Not to mention the functions are also translated to the other language.

This makes a lot of sense when you recognize that Excel formulas, unlike proper programming languages, aren't necessarily written by people with a sufficient grasp of the English language, especially when it comes to more abstract mathematical concepts, which aren't taught in secondary English language classes at school, but it in their native language mathematics classes.

simulo•1h ago
Oh, good to know that it depends on locale, I always wondered about that behavior!
layer8•43m ago
Given that world is about evenly split on the decimal separator [0] (and correspondingly on the thousands grouping separator), it’s hard to avoid. You could standardize on “;” as the argument separator, but “1,000” would still remain ambiguous.

[0] https://en.wikipedia.org/wiki/Decimal_separator#Conventions_...

WA•39m ago
Try Apple Numbers, where even function names are translated and you can’t copy & paste without an error if your locale is, say, German.
neves•29m ago
aha, in Microsoft Excel they translate even the shortcuts. The Brazilian version Ctrl-s is "Underline" instead of "Save". Every sheet of mine ends with a lot of underlined cells :-)
fainpul•25m ago
Not sure if this still is the case, but Excel used to fail to open CSV files correctly if the locale used another list separator than ',' – for example ';'.
eska•7m ago
I’m happy to report it still fails and causes me great pain.
Aransentin•2h ago
Note that <html> and <body> auto-close and don't need to be terminated.

Also, wrapping the <head> tags in an actual <head></head> is optional.

You also don't need the quotes as long the attribute doesn't have spaces or the like; <html lang=en> is OK.

(kind of pointless as the average website fetches a bazillion bytes of javascript for every page load nowadays, but sometimes slimming things down as much as possible can be fun and satisfying)

chrismorgan•2h ago
<html>, <head> and <body> start and end tags are all optional. In practice, you shouldn’t omit the <html> start tag because of the lang attribute, but the others never need any attributes. (If you’re putting attributes or classes on the body element, consider whether the html element is more appropriate.) It’s a long time since I wrote <head>, </head>, <body>, </body> or </html>.
zelphirkalt•1h ago
This kind of thing will always just feel shoddy to me. It is not much work to properly close a tag. The number of bytes saved is negligible, compared to basically any other aspect of a website. Avoiding not needed div spam already would save more. Or for example making sure CSS is not bloated. And of course avoiding downloading 3MB of JS.

What this achieves is making the syntax more irregular and harder to parse. I wish all these tolerances wouldn't exist in HTML5 and browsers simply showed an error, instead of being lenient. It would greatly simplify browser code and HTML spec.

ifwinterco•1h ago
You're not alone, this is called XHTML and it was tried but not enough people wanted to use it
sevenseacat•1h ago
oh man, I wish XHTML had won the war. But so many people (and CMSes) were creating dodgy markup that simply rendered yellow screens of doom, that no-one wanted it :(
adzm•27m ago
i'm glad it never caught on. the case sensitivity (especially for css), having to remember the xmlns namespace URI in the root element, CDATA sections for inline scripts, and insane ideas from companies about extending it further with more xml namespaced elements... it was madness.
zelphirkalt•48m ago
Yeah, I remember, when I was at school and first learning HTML and this kind of stuff. When I stumbled upon XHTML, I right away adapted my approach to verify my page as valid XHTML. Guess I was always on this side of things. Maybe machine empathy? Or also human empathy, because someone needs to write those parsers and the logic to process this stuff.
Aransentin•1h ago
I agree for sure, but that's a problem with the spec, not the website. If there are multiple ways of doing something you might as well do the minimal one. The parser will have always to be able to handle all the edge cases no matter what anyway.

You might want always consistently terminate all tags and such for aesthetic or human-centered (reduced cognitive load, easier scanning) reasons though, I'd accept that.

bentley•1h ago
Implicit elements and end tags have been a part of HTML since the very beginning. They introduce zero ambiguity to the language, they’re very widely used, and any parser incapable of handling them violates the spec and would be incapable of handling piles of real‐world strict, standards‐compliant HTML.

> I wish all these tolerances wouldn't exist in HTML5 and browsers simply showed an error, instead of being lenient.

They (W3C) tried that with XHTML. It was soundly rejected by webpage authors and by browser vendors. Nobody wants the Yellow Screen of Death. https://en.wikipedia.org/wiki/File:Yellow_screen_of_death.pn...

shiomiru•50m ago
> It would greatly simplify browser code and HTML spec.

I doubt it would make a dent - e.g. in the "skipping <head>" case, you'd be replacing the error recovery mechanism of "jump to the next insertion mode" with "display an error", but a) you'd still need the code path to handle it, b) now you're in the business of producing good error messages which is notoriously difficult.

Something that would actually make the parser a lot simpler is removing document.write, which has been obsolete ever since the introduction of the DOM and whose main remaining real world use-case seems to be ad delivery. (If it's not clear why this would help, consider that document.write can write scripts that call document.write, etc.)

nodesocket•1h ago
Didn't know you can omit <head> .. </head> but I prefer for clarify to keep them.
bentley•1h ago
Do you also spell out the implicit <tbody> in all your tables for clarity?
ndegruchy•1h ago
I do.

`<thead>` and `<tfoot>`, too, if they're needed. I try to use all the free stuff that HTML gives you without needing to reach for JS. It's a surprising amount. Coupled with CSS and you can get pretty far without needing anything. Even just having `<template>` with minimal JS enables a ton of 'interactivity'.

christophilus•58m ago
Yes. Explicit is almost always better than implicit, in my experience.
hlava•2h ago
It's 2025, the end of it. Is this really necessary to share?
4ndrewl•1h ago
Yes. Knowledge is not equally distributed.
troupo•1h ago
Every day you can expect 10000 people learning a thing you thought everyone knew: https://xkcd.com/1053/

To quote the alt text: "Saying 'what kind of an idiot doesn't know about the Yellowstone supervolcano' is so much more boring than telling someone about the Yellowstone supervolcano for the first time."

allknowingfrog•28m ago
XKCD 1053 is a way of life. I think about it all the time, and it has made me a better human being.
nonethewiser•40m ago
Feels even more important to share honestly. It's unexamined boilerplate at this point.
isolay•1h ago
The "without meta utf-8" part of course depends on your browser's default encoding.
kevin_thibedeau•1h ago
What mainstream browsers aren't defaulting to utf-8 in 2025?
naniwaduni•44m ago
All of them, pretty much.
akho•40m ago
html5 does not even allow any other values in <meta charset=>. I think you need to use a different doctype to get what the screenshot shows.
layer8•27m ago
While true, they also require user agents to support other encodings specified that way: https://html.spec.whatwg.org/multipage/parsing.html#characte...

Another funny thing here is that they say “but not limited to” (the listed encodings), but then say “must not support other encodings” (than the listed ones).

layer8•39m ago
I wouldn’t be surprised if they don’t for pages loaded from local file URIs.
ilaksh•1h ago
Anyone else prefer to use web components without bundling?

I probably should not admit this, but I have been using Lit Elements with raw JavaScript code. Because I stopped using autocomplete awhile ago.

I guess not using TypeScript at this point is basically the equivalent for many people these days of saying that I use punch cards.

VPenkov•1h ago
37 Signals [0] famously uses their own Stimulus [1] framework on most of their products. Their CEO is a proponent of the whole no-build approach because of the additional complexity it adds, and because it makes it difficult for people to pop your code and learn from it.

[0]: https://basecamp.com/ [1]: https://stimulus.hotwired.dev/

christophilus•1h ago
Dunno. You can build without minifying if you want it to be (mostly) readable. I wouldn’t want to give up static typing again in my career.
nonethewiser•44m ago
Can't say I generally agree with dropping TS for JS but I suppose it's easier to argue when you are working on smaller projects. But here is someone that agrees with you with less qualification than that https://world.hey.com/dhh/turbo-8-is-dropping-typescript-701...

I was introduced to this decision from the Lex Fridman/DHH podcast. He talked a lot about typescript making meta programming very hard. I can see how that would be the case but I don't really understand what sort of meta programming you can do with JS. The general dynamic-ness of it I get.

lapcat•1h ago

  <meta name="viewport" content="width=device-width,initial-scale=1.0">
width=device-width is actually redundant and cargo culting. All you need is initial-scale. I explain in a bit more detail here: https://news.ycombinator.com/item?id=36112889
aragonite•1h ago
Fun fact: both HN and (no doubt not coincidentally) paulgraham.com ship no DOCTYPE and are rendered in Quirks Mode. You can see this in devtools by evaluating `document.compatMode`.

I ran into this because I have a little userscript I inject everywhere that helps me copy text in hovered elements (not just links). It does:

[...document.querySelectorAll(":hover")].at(-1)

to grab the innermost hovered element. It works fine on standards-mode pages, but it's flaky on quirks-mode pages.

Question: is there any straightforward & clean way as a user to force a quirks-mode page to render in standards mode? I know you can do something like:

document.write("<!DOCTYPE html>" + document.documentElement.innerHTML);

but that blows away the entire document & introduces a ton of problems. Is there a cleaner trick?

jraph•1h ago
> <!doctype html> is what you want for consistent rendering. Or <!DOCTYPE HTML> if you prefer writing markup like it’s 1998. Or even <!doCTypE HTml> if you eschew all societal norms. It’s case-insensitive so they’ll all work.

And <!DOCTYPE html> if you want polyglot (X)HTML.

bombcar•30m ago
We need HTML Sophisticated - <!Dr. Type, HtML, PhD>
dugmartin•55m ago
I know this was a joke:

   <div id="root"></div>
   <script src="bundle.js"></script>
but I feel there is a last tag missing:

   <main>...</main>
that will ensure screenreaders skip all your page "chrome" and make life much easier for a lot of folks. As a bonus mark any navigation elements inside main using <nav> (or role="navigation").
eska•9m ago
I’m not a blind person but I was curious about once when I tried to make a hyper-optimized website. It seemed like the best way to please screen readers was to have the navigation HTML come last, but style it so it visually comes first (top nav bar on phones, left nav menu on wider screens).
hnthrowaway121•6m ago
Wouldn’t that run afoul of other rules like keeping visual order and tab order the same? Screen reader users are used to skip links & other standard navigation techniques.

Rust cross-platform GPUI components

https://github.com/longbridge/gpui-component
215•xvilka•4h ago•67 comments

Don't forget these tags to make HTML work like you expect

https://blog.jim-nielsen.com/2025/dont-forget-these-html-tags/
128•FromTheArchives•4h ago•55 comments

Recall for Linux

https://github.com/rolflobker/recall-for-linux
319•anticensor•6h ago•132 comments

Microsoft needs to open up more about its OpenAI dealings

https://www.wsj.com/tech/ai/microsoft-needs-to-open-up-more-about-its-openai-dealings-59102de8
143•zerosizedweasle•2h ago•81 comments

WorldGrow: Generating Infinite 3D World

https://github.com/world-grow/WorldGrow
48•cdani•4h ago•32 comments

Corrosion

https://fly.io/blog/corrosion/
50•cgb_•4d ago•8 comments

Unexpected patterns in historical astronomical observations

https://www.su.se/english/news/unexpected-patterns-in-historical-astronomical-observations-1.855042
32•XzetaU8•3d ago•1 comments

Why I'm teaching kids to hack computers

https://www.hacktivate.app/why-teach-kids-to-hack
132•twostraws•5d ago•52 comments

Geoutil.com – Measure distances, areas, and convert geo data in the browser

https://geoutil.com
72•FreeGuessr•6d ago•13 comments

Artifact (YC W25) is hiring engineers in NYC to build modern ECAD

1•antonysamuel•2h ago

How I turned Zig into my favorite language to write network programs in

https://lalinsky.com/2025/10/26/zio-async-io-for-zig.html
267•0x1997•14h ago•93 comments

What happened to running what you wanted on your own machine?

https://hackaday.com/2025/10/22/what-happened-to-running-what-you-wanted-on-your-own-machine/
193•marbartolome•5h ago•103 comments

You are how you act

https://boz.com/articles/you-are-how-you-act
145•HiPHInch•2h ago•105 comments

Isomorphic JS/TS Functions Orchestrator

https://github.com/damianofalcioni/js-functions-orchestrator
3•damianofalcioni•2h ago•0 comments

Show HN: Write Go code in JavaScript files

https://www.npmjs.com/package/vite-plugin-use-golang
95•yar-kravtsov•8h ago•31 comments

Structure and Interpretation of Classical Mechanics (2014)

https://tgvaughan.github.io/sicm/toc.html
64•the-mitr•9h ago•20 comments

You already have a Git server

https://maurycyz.com/misc/easy_git/
584•chmaynard•1d ago•387 comments

Show HN: MyraOS – My 32-bit operating system in C and ASM (Hack Club project)

https://github.com/dvir-biton/MyraOS
210•dvirbt•17h ago•42 comments

Enchanting Imposters

https://daily.jstor.org/enchanting-imposters/
22•Petiver•5d ago•1 comments

If your adversary is the mossad (2014) [pdf]

https://www.usenix.org/system/files/1401_08-12_mickens.pdf
181•xeonmc•5h ago•133 comments

Sandhill cranes have adopted a Canada gosling

https://www.smithsonianmag.com/science-nature/these-sandhill-cranes-have-adopted-a-canadian-gosli...
117•NaOH•4d ago•32 comments

Ken Thompson recalls Unix's rowdy, lock-picking origins

https://thenewstack.io/ken-thompson-recalls-unixs-rowdy-lock-picking-origins/
194•dxs•21h ago•35 comments

An overengineered solution to `sort | uniq -c` with 25x throughput (hist)

https://github.com/noamteyssier/hist-rs
88•noamteyssier•4d ago•61 comments

Sphere Computer – The Innovative 1970s Computer Company Everyone Forgot

https://sphere.computer/
79•ChrisArchitect•3d ago•7 comments

A definition of AGI

https://arxiv.org/abs/2510.18212
263•pegasus•20h ago•426 comments

Are-we-fast-yet implementations in Oberon, C++, C, Pascal, Micron and Luon

https://github.com/rochus-keller/Are-we-fast-yet
74•luismedel•15h ago•19 comments

Should LLMs just treat text content as an image?

https://www.seangoedecke.com/text-tokens-as-image-tokens/
62•ingve•6d ago•43 comments

A bug that taught me more about PyTorch than years of using it

https://elanapearl.github.io/blog/2025/the-bug-that-taught-me-pytorch/
414•bblcla•3d ago•76 comments

Feed the bots

https://maurycyz.com/misc/the_cost_of_trash/
259•chmaynard•1d ago•180 comments

We saved $500k per year by rolling our own "S3"

https://engineering.nanit.com/how-we-saved-500-000-per-year-by-rolling-our-own-s3-6caec1ee1143
272•mpweiher•17h ago•220 comments