Live data from Hacker News

HN's HTML Is Invalid

validator.w3.org

31–40 of 62 posts

Re: HN's HTML Is Invalid

#31
I think a lot of those are bogus, but there are some real ones such as cases where there is no space between attributes, like

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

Re: HN's HTML Is Invalid

#32

Earlier quoted context omitted.

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

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

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

Re: HN's HTML Is Invalid

#33
post #22

In defense, half of these look like what I'd call "normal" HTML, granted I'm not up on the latest fads. But " " 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 Edit: I seem to be mistaken about…

> And yet to see a browser that actually cares about DOCTYPE...usually its pretty obvious when the next line is

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

Re: HN's HTML Is Invalid

#34

Earlier quoted context omitted.

Tables are still in the HTML spec. Not really practical to represent tabular data with grid layout.

But also not practical to do page layouts with tables.

It’s how we did it it in the 90’s, also I think it still worked better than the alternatives until we got grid and flexbox.

Re: HN's HTML Is Invalid

#36

The overwhelming majority of HTML on the web is invalid. Achieving 100% valid HTML nowadays is a fools errand, save for extremely simple web pages.

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

Re: HN's HTML Is Invalid

#37
The 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.

Re: HN's HTML Is Invalid

#38
post #22

In defense, half of these look like what I'd call "normal" HTML, granted I'm not up on the latest fads. But " " 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 Edit: I seem to be mistaken about…

> And yet to see a browser that actually cares about DOCTYPE...usually its pretty obvious when the next line is 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, , is the simplest possible, and the one recommended by current HTML standards. Earlier v…

So 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 tag, because what else could it even be?

Post reply on HN