Live data from Hacker News

Write HTML Right

lofi.limo

71–80 of 212 posts

Re: Write HTML Right

#71

> A few years ago, I found out I'd been tying my shoes wrong for my entire life. I thought laces came undone easily and didn't usually look very good. At least that's how mine were, and I never paid much attention to anyone else's. It took a couple of weeks to re-train my hands but now I have bows in my laces that look good and rarely come undone. I’m equally interested in this as the HTML. Any clue what the author i…

Aw... you didn't read to the end ;)

> The right way to tie your shoes is with a square knot. It's easy to confuse this with the granny knot, which is the wrong way. The square knot is a simple and sound knot with many uses. The granny knot is an unsound knot whose only known uses are to make your shoelaces look crooked and to trip you.

Re: Write HTML Right

#72

> A few years ago, I found out I'd been tying my shoes wrong for my entire life. I thought laces came undone easily and didn't usually look very good. At least that's how mine were, and I never paid much attention to anyone else's. It took a couple of weeks to re-train my hands but now I have bows in my laces that look good and rarely come undone. I’m equally interested in this as the HTML. Any clue what the author i…

Likely the author was tying granny knots instead of slipped/bowed reef knots

If your first cross is left over right you need to make your second cross right over left, or vice versa. I found an image showing the difference for the un-slipped version, but it's the same with a bow: http://www.tikalon.com/blog/2020/square_granny_knots.png

Granny knots untie themselves and the bow will end up perpendicular to the knot instead of parallel.

Re: Write HTML Right

#73

> A few years ago, I found out I'd been tying my shoes wrong for my entire life. I thought laces came undone easily and didn't usually look very good. At least that's how mine were, and I never paid much attention to anyone else's. It took a couple of weeks to re-train my hands but now I have bows in my laces that look good and rarely come undone. I’m equally interested in this as the HTML. Any clue what the author i…

Possibly the Ian knot https://www.fieggen.com/shoelace/ianknot.htm

You look goofy trying to relearn to tie your shoes, but it really is fast and sturdy.

Re: Write HTML Right

#76
post #53

Earlier quoted context omitted.

There was never a well-substantiated argument for the alleged harm of layout tables. Demonizing them mostly just stemmed from the cult of wanting to completely confine layout to CSS vs. expressing semantics with HTML. In the end that “CSS zen” was never really achieved, because the dependencies between HTML structure and styling are just too many and too strong.

> There was never a well-substantiated argument for the alleged harm of layout tables. What was the best argument that you can recall? What were some of the bad ones? What does "harm" mean in this context? > because the dependencies between HTML structure and styling are just too many and too strong. Which dependencies? What would a structure/styling language combination look like that that lacked or had weak depende…

> What was the best argument that you can recall?

I mostly recall “layout belongs into CSS files” (so a matter of principle) and “layout tables are bad for accessibility”, which while in theory could be an important point, in practice screenreaders had already adapted, and had (still have) very practical heuristics to distinguish layout tables from data tables (see e.g. https://webaim.org/techniques/tables/).

The thing is, at the time, using CSS to achieve the equivalent of layout tables was an exercise in frustration and futility, in that the results were exceedingly brittle and very often broke when either the table content, the surrounding elements or the browser window size changed too much.

Nowadays we have CSS grid and flexbox of course, but I imagine that in some cases a layout table could still be the most straightforward solution today.

> Which dependencies?

The fantasy back then was that it would be possible to define the HTML content and structure completely independently from layout and styling considerations, and then a separate CSS file could be used to specify any conceivable styling and layout for that content. While that is true to a certain extent, it usually breaks down as soon as you need HTML elements to be in a different order or nesting relation, or when you need additional intermediate nesting DIVs, etc.

In reality the HTML structure and the CSS structure (bound to each other by IDs, class names, hierarchical selectors etc.) is so closely intertwined, and the mapping points (i.e. IDs, class name combinations, etc.) are so many that, for the most part, only superficial changes can be made to one side without having to also make some adjustment on the other side. Ideally, it would be possible for an HTML author and a CSS author for the same web page to mostly work independently from each other. In reality this is almost impossible, except for the case where the HTML remains basically unchanged and the CSS can change within the constraints of the existing HTML structure.

Banning layout tables was never going to be a major factor in coming substantially closer to the imagined ideal here.

> What would a structure/styling language combination look like that that lacked or had weak dependencies?

I think it’s inherently difficult, because you will always need to specify which styles/classes should apply to which element in a rather fine-grained manner, which just means there will always be a lot of dependencies between the two sides.

One thing you’d need in order to realize arbitrary layout is a way of mapping structured content into a different structure. That basically means having a functional programming language to define the mapping, if you want to have full flexibility.

Re: Write HTML Right

#77
post #74

The lack of closing tags is giving me severe anxiety. I know it's valid non-xml syntax but all the hairs on my neck are at attention.

I agree, and unless someone has a better reason than the ones I have seen, (saving tiny amount of bytes, less keystrokes, dx) I am convinced it's a bad idea to omit the end tags.

It causes way more trouble than those benefits are worth

Re: Write HTML Right

#78
post #33

In 2022 how often do you actually write text by hand in your HTML files? I find that beside the few buttons here and there (and that's if you don't have i18n), text is always going to be served by a server. In 2022 we also all use text editors or IDEs that can collapse entire blocks of tags, to improve readability. I'm not sure I can see a clear benefit here outside of very few edge cases, and I am sure it comes with…

Static site generators (Jekyll, Hugo) are one example. Sometimes you can get away with markdown but often you end up marking up pages of text.

Even when you need to write actual HTML you still should use shorthand tools like emmet to write your markup faster and with less mistakes.

Re: Write HTML Right

#79

> A few years ago, I found out I'd been tying my shoes wrong for my entire life. I thought laces came undone easily and didn't usually look very good. At least that's how mine were, and I never paid much attention to anyone else's. It took a couple of weeks to re-train my hands but now I have bows in my laces that look good and rarely come undone. I’m equally interested in this as the HTML. Any clue what the author i…

What immediately came to mind for me was this (short) Ted talk https://youtu.be/zAFcV7zuUDA

Re: Write HTML Right

#80
No thanks. With the full markup you can see where things end, not just where they start.

I think this is similar to semicolons in Javascript: with semicolons at the end of each statement there is no ambiguity, but if you do not have semicolons, you have to know about edge cases, like if a line starts with a square bracket or paren.

Post reply on HN