4 ms·
hn's nested threads built with <table> are so simple that they're brilliant. No horizontal scrolling, no flipping between pages, just click "reply" and you're g
by petercooper 16y ago
hn's nested threads built with <table> are so simple that they're brilliant. No horizontal scrolling, no flipping between pages, just click "reply" and you're good to go.
I don't think <table>s should get undue praise. With <div>s, the code would be easier to read mechanically (for manipulation with Greasemonkey, say) and even though there'd be a little more CSS, the page weight might be reduced a little (I'd have to make a mockup to be sure ;-))
- omouse 16y ago^^ THIS. I love it when sites use DIVs because it makes much much easier to chop them up and display them the way I want to by using Stylish or GreaseMonkey. The browser is a customizable viewer...your stylesheet is just a suggestion.
- petercooper 16y agoIf you use Selector Gadget - http://www.selectorgadget.com/ http://www.selectorgadget.com/ - it's possible to divine pretty horrible and complex CSS and XPath matches for things on Hacker News but.. they're far from entirely reliable. A lot of ugly TABLE TD:nth-child(5) stuff..
- coderdude 16y agoI disagree. Tables are still the most reliable way to display content under nearly all circumstances (maybe less so on mobiles, but definitely on the desktop). They've been stable for years and years. I went through the hardcore standards phase where I thought it would be the death of my soul if I ever went back to using tables for layout, but then I read a great article (wish I had the link) that struck a chord with me. It said you don't have to avoid tables for certain small situations where it can save you a ton of time and a few headaches. I would never suggest doing a whole layout in tables, but I think the comments on HN are a good example of something that would have been a pain in the ass to get right across all browsers. Just use tables for layout if it actually makes sense and even then, ever so sparingly.
- barmstrong 16y agoYeah this could quickly devolve into a flame about divs vs tables. But divs I always saw as a step backwards in one aspect: programmer ease of use. In divs you have to spend time thinking about "float drop", doing math in your head, and getting all the columns to have the same height - things which "just work" in tables. It still surprises me sometimes how quickly they were adopted.
- petercooper 16y agoBut divs I always saw as a step backwards in one aspect: programmer ease of use. It's always a lot easier at first to overlook structure in your app/code/whatever. It's when you or others come to work with your code or extend it in some way (with Greasemonkey, say) that all the extra work comes along. If you have to "spend time thinking about" writing tests, it takes longer to build the prototype of your software but.. that's not a particularly good rationale for not using tests (though it is still a rationale, of course). Same goes for semantic markup in my book.
- _pius 16y agoTables are still the most reliable way to display content under nearly all circumstances (maybe less so on mobiles, but definitely on the desktop). I don't think that's been true for several years.
- subbu 16y ago<div>'s might make sense from a purist's point of view or even from a experienced web dev's point of view. But I think, hn's changes have been based on pragmatism. So tables could be one of that. I remember pg saying he left out search feature saying google does a good job of that.
- mshafrir 16y agoDon't unordered lists make more sense than divs in this case?
- ronnier 16y agoI actually think the best way to display these types of comments is with nested UL/LI's. It makes it really easy to call a recursive function to write out the comments then adjust the indentation with CSS. For my mobile HN site, I do just that. From there, it was trivial to add in the ability to collapse and expand comments. For example, view this page through my reader (It's meant for mobile phones): http://toadjaw.com/hn/comments/1398250 http://toadjaw.com/hn/comments/1398250