5 ms·
HN's HTML Is Invalid
- dickfickling 3y ago(if it wasn't clear, this is submitted in jest)
- Clent 3y agoPerhaps it is in jest but these are errors not warnings and there are a lot of them. Fixing them would be trivial. "Yeah but it works" is not engineering.
- water9 3y agoDANG what a blunder
- H8crilA 3y agoNo, this is a 4D chess move. Since everything in web technology is circular he is just waiting for the page to become compliant again. It'll look impressive on the Internet Archive, so far ahead of its times! And with no effort whatsoever. This also applies to the visual style.
- Juliate 3y agoSo what?
- superkuh 3y agoThe validator's HTML is invalid too. All I get is "Enable JavaScript and cookies to continue" but of course doing that doesn't actually work either. It's crazy that even the W3C has put itself behind cloudflare's walled garden. You'd think if anyone would respect the open web and standards it'd be them. At least HN's page is actually HTML even if it might not be fully standards compliant. That's far better than the W3C's showing here.
- CharlesW 3y ago> All I get is "Enable JavaScript and cookies to continue" but of course doing that doesn't actually work either. It does for me. Also, the validator shows 10 warnings and 30 info messages for https://www.w3.org/ https://www.w3.org/.
- sodapopcan 3y agoAh, cellpadding and cellspacing. A blast from the past!
- foobarian 3y agoWait, there is something newer now?
- throwanem 3y agoTables first came to be used as a tool for general page layout because IE 5's box model sucked so bad nothing else really worked. It has been a minute since that constraint applied, yeah.
- mypetocean 3y agoTables first came to be used for displaying tabular (spreadsheet-like) data – which was what it was designed for. And for that purpose, it's still the best option.
- throwanem 3y agoYes, that's why they're in the spec and is the case where their use is still valid, but that's why I qualified my prior comment. HN dates from the period I described and still uses tables for general page layout, hence the original commenter's query to which I replied.
- timeon 3y ago> HN dates from the period I described and still uses tables for general page layout According to Wiki HN dates from 2007. I think Yahoo moved from table to CSS layout earlier. CSS Zen Garden is from around 2003.
- throwanem 3y agoAll true, but the point at which web dev more generally moved to CSS over tables was considerably later, not least because early CSS was pretty hard to find resources on and work effectively with. Firebug helped a lot from 2005 on, as of course also the browser-native devtools it inspired, but in 2007 it remained far from a surprise to see sites built in what was then still a current, if not the latest, style.
- gerikson 3y agoOh no, someone call the Internet police.
- somecompanyguy 3y ago[dead]
- Wronnay 3y agoWhich shows that you don't need valid HTML to be successful
- zagrebian 3y agoThe biggest websites are proof that you don’t need web accessibility to be successful either, but that doesn’t make it right.
- marginalia_nu 3y agoI think it's a mistake to conflate being correct (technical property) with being right (moral judgement). Adhering to a standard is quite optional, and most HTML ever written does not. That's just the way it is. This isn't wrong, but it is incorrect.
- zagrebian 3y agoThe question is, is adhering to the HTML Standard (in other words, getting zero errors in the HTML validator) beneficial to websites? For example, does it make the job of web developers easier? Are there fewer user-reported issues in browsers?
- firedguy2023 3y ago[flagged]
- steviedotboston 3y agoThe overwhelming majority of HTML on the web is invalid. Achieving 100% valid HTML nowadays is a fools errand, save for extremely simple web pages.
- nathanaldensr 3y agoIt's not a fool's errand. It's quite simple to do, especially incrementally. Even still, you're implying a false dichotomy; HN's HTML can certainly be much, much improved from where it is now, even if it's not perfect.
- deleted 3y ago[deleted]
- 5350-uiop-1130 3y agoisn't it only xhtml that needs to be strictly valid.... i mean the garbage that gets churned out by react and node generators these days is barely even html.
- qawwads 3y agoJambo mouzugu. Mambo vipi!
- trinsic2 3y agoSpeaking of the HTML it would be great to have a way to increase the text size for mobile devices. The Hacker News layout doesn't look to great in reader view.
- deleted 3y ago[deleted]
- PennRobotics 3y agoIf your mobile browser is Chrome-based, there should be an Accessibility setting called "Show zoom option in main menu", which I believe then shows up between Recent Tabs and Share. I'm able to zoom HN this way.
- vishnugupta 3y agoNo discussion on HTML validation/parsing is complete without mentioning this all time SO classic https://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags https://stackoverflow.com/questions/1732348/regex-match-open...
- petee 3y agoIn defense, half of these look like what I'd call "normal" HTML, granted I'm not up on the latest fads. But "<center>" is depreciated now? Come on. "Width" and "height" attributes too? To what purpose? They are clear, easy to use, and apparently still widely supported with no issue. And yet to see a browser that actually cares about DOCTYPE...usually its pretty obvious when the next line is <html> Edit: I seem to be mistaken about the importance of doctype for some situations.
- ElectricalUnion 3y ago> And yet to see a browser that actually cares about DOCTYPE...usually its pretty obvious when the next line is <html> How do browsers determine which mode to use? For HTML documents, browsers use a DOCTYPE in the beginning of the document to decide whether to handle it in quirks mode or standards mode. The DOCTYPE shown in the example, <!DOCTYPE html>, is the simplest possible, and the one recommended by current HTML standards. Earlier versions of the HTML standard recommended other variants, but all existing browsers today will use full standards mode for this DOCTYPE, even the dated Internet Explorer 6. There are no valid reasons to use a more complicated DOCTYPE. If you do use another DOCTYPE, you may risk choosing one which triggers almost standards mode or quirks mode. Make sure you put the DOCTYPE right at the beginning of your HTML document. Anything before the DOCTYPE, like a comment or an XML declaration will trigger quirks mode in Internet Explorer 9 and older. The only purpose of <!DOCTYPE html> is to activate no-quirks mode. Older versions of HTML standard DOCTYPEs provided additional meaning, but no browser ever used the DOCTYPE for anything other than switching between render modes. https://developer.mozilla.org/en-US/docs/Web/HTML/Quirks_Mode_and_Standards_Mode https://developer.mozilla.org/en-US/docs/Web/HTML/Quirks_Mod...
- petee 3y agoSo no real use, got it. Luckily IE 9 has been gone for awhile My point was its silly because the html self-defines being html the second you open the <html> tag, because what else could it even be?
- 3y ago
- intrasight 3y agoThere was a time when I demanded of myself that all the sites that I built for clients had a perfect validation score. Well, I no longer build web sites.
- deleted 3y ago[deleted]
- PaulHoule 3y agoI think a lot of those are bogus, but there are some real ones such as cases where there is no space between attributes, like <element this=“that”in=“out”/> there are a lot of old elements being used where css could be used instead, probably if the HTML was updated like that and they were smart about selectors it would get the page size down a bit. Then there is the <doctype> thing which may seem like a lot of bullshit, I don’t know how it now but years ago it did make a difference because if you didn’t have it browsers would go into a compatibility mode with old web pages. Part of Netscape’s competitive advantage back in the day was that it handled broken HTML in an undocumented way and broken HTML is so common that a browser that doesn’t handle broken HTML the same way is a broken browser. One of the many great things in HTML is that it defines that behavior. It would be a fun project to CSS-ize the HN front page with an aim to minimizing size.
- zagrebian 3y ago> Then there is the <doctype> thing which may seem like a lot of bullshit, I don’t know how it now but years ago it did make a difference because if you didn’t have it browsers would go into a compatibility mode with old web pages. This is still true. Browsers run HN in quirks mode. Just open the devtools console in Firefox, and it will tell you.
- paxys 3y agoThere's a distinction (that the validator doesn't make) between "invalid" and simply being an older version.
- deleted 3y ago[deleted]
- PennRobotics 3y agoThe CSS is also inconsistent, if not invalid. (I noticed this two weeks ago while creating a theme for a SSG.) One rule is duplicated (a:visited) where it seems it should refer to a specific class (.hnmore a:visited): a:link { color:#000000; text-decoration:none; } a:visited { color:#828282; text-decoration:none; } ... .subtext a:link, .subtext a:visited { color:#828282; } .subtext a:hover { text-decoration:underline; } .comhead a:link, .subtext a:visited { color:#828282; } .comhead a:hover { text-decoration:underline; } .hnmore a:link, a:visited { color:#828282; } .hnmore { text-decoration:underline; } Some lines don't have a trailing semicolon while the majority do. 0 probably doesn't need units. ".votelinks.nosee div.votearrow.rotate180" could just have one class rather than this nested thing. The single-pixel gif as a spacer, that takes my mind back to Geocities. Sums up software pretty well. If it works, move on to the next thing. No need to get lost in the details that a tiny handful of people see.
- TruffleLabs 3y agoBut HN still works good enough:)
- johnea 3y agoPlain Text Rules! If you need tables, render in a fixed width font. HTML in email sucks in many more ways than are described here...
- BetaPictoris 3y agoUgh… Don’t get me started on HTML in emails. What was so wrong with plaintext for emails? Vomit (meant to type Comic, but the typo is staying) Sans? Non-W3 compliant contrast ratios? Nineteen embedded images? Seriously, if I want to send you the pictures from the beach I can do it with an attachment. Plaintext works, but as the great David Bowie said: “If it works, it’s out of date.”