This works for blog posts, where the body of the document is one long block of paragraphs, but I suspect this style would quickly become untenable for complex apps. Indentation _is_ information, which is lost here.
That’s why HTML is not a language for ‘apps’.
Write HTML Right
31–40 of 212 posts
Re: Write HTML Right
#32Earlier quoted context omitted.
Sure, but the author is advocating that you compose HTML this way. It would quickly become a mess of nested elements with zero visual indication of hierarchy. The DOM is a tree, with nested elements. Losing that information doesn't get you anything but tag soup (which is, oddly, what the author suggests this style is supposed to avoid)
In a tree you have branches off branches off branches etc. You can’t orient yourself - you can’t tell where you are - unless you count the branches. And indenting makes that visible. In the examples for TFA, you can tell your location from the names of the elements. Eg is enough for you to know you’re probably inside a tr inside a table. And that is the more common case than the general tree example. But a method of…
Re: Write HTML Right
#33In 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…
Re: Write HTML Right
#34Earlier quoted context omitted.
In a tree you have branches off branches off branches etc. You can’t orient yourself - you can’t tell where you are - unless you count the branches. And indenting makes that visible. In the examples for TFA, you can tell your location from the names of the elements. Eg is enough for you to know you’re probably inside a tr inside a table. And that is the more common case than the general tree example. But a method of…
What’s a TFA?
Re: Write HTML Right
#35
It's not verbose after all, and IIUC may be omitted if and only if the document is served with corresponding information in `Content-Language:` HTTP header, but nasty (or rather annoying) things may happen if that fails [1], so when it comes to "right HTML", following this advice sounds reasonable.[1] https://adrianroselli.com/2015/01/on-use-of-lang-attribute.h...
Re: Write HTML Right
#36Re: Write HTML Right
#37Re: Write HTML Right
#38Closing li tags is the right thing to do! I always close the kitchen drawer too after putting the scissors back. But I rarely write HTML as content anyway, it's mostly templates for the CMS, where it's best to close the tags.
Re: Write HTML Right
#39Earlier quoted context omitted.
That’s why HTML is not a language for ‘apps’.
Except for the fact that native apps also use SGML or XML inspired markup for their layout engines. A tree of heterogeneous objects maps extremely well to how people think about UI.
What really needs to happen it a separation of HTML from UI markup elements. HTML will be used solely for textual markup and a new markup language can be used for UIs. This would allow us to return to a proper separation of concerns.
Re: Write HTML Right
#40Earlier quoted context omitted.
…for non-tabular data such as “your pretty design elements that frame and organize the text because it is 1995 and CSS doesn’t exist yet and this is the only tool at your disposal for aligning stuff across the page”. Or because it is 2000 and putting stuff where you want it is a hell of CSS2 floats and box models and eventually you just say “fuck it” and assign table-like behavior to a bunch of divs because Tables Fo…
It’s funny you bring this up because while I have joined the Tables For Layout Are Considered Harmful club, I never really have heard a completely convincing argument on why tables have this bad rap. I think it’s mostly because, semantically, tables don’t make sense for layout, but back in the days before frameworks such as Foundation and Bootstrap (and more recently native CSS3 mechanisms), tables with invisible bor…
Divs that follow the document's semantic hierarchy and are positioned on your CSS have none of those issues.
Anyway, a lot of ways to use Bootstrap and other grid-based frameworks introduce the same problems back. And if you want to really display things in a table, well, a table fits quite well your requirements.