4 ms·
HTML is a text markup language and hence not very well suited to build a logical structure for the same reason that xml is not very well suited to describe data
by valenterry 6y ago
HTML is a text markup language and hence not very well suited to build a logical structure for the same reason that xml is not very well suited to describe data. And that is not because it cannot do it, but because it is too powerful.
What is better in my opinion is a mix. Use one language or specification to model your architecture and structure and then, strictly on top of that, write (x)html to define your content. (you could also use markdown, just choose a markup language)
Then, for the layout/design, use CSS that is completely separate from your site's structure and content; read: separate file, not embedded in the rest. Well, maybe CSS is insufficient and you also need to use Javascript or some language on top of it because the CSS is still lacking of lot of important things, but that's not a principal problem but a specific problem of CSS as a language.
- TekMol 6y agoWith HTML you define a tree of elements. And you assign IDs and classes to those elements. How is that not well suited to build a logical structure?
- kevincox 6y agoBecause HTML (excluding web components which require JavaScript) doesn't have any way to handle repetition and conditionals. Of ccourse the commenter does mention using a templating language but a lot of people will be annoyed with this basic language and just want the full lower of JS to generate the site structure.
- tonyedgecombe 6y agodoesn't have any way to handle religion <a religion="christian" href="...
- kevincox 6y agoFixed to repetition.
- valenterry 6y agoBecause it is too powerful. You can do something like this: <div class="main"> oh <div class="sub"> hello </div> </div> This is valid HMTL but it is not a valid structure in any context that I could imagine, because what is the "oh" supposed to do there? To prevent these (and other) mistakes, the way you can build up the structure should be restricted in a meaningful way and certainly not allow text and random positions and similar things. You could then describe this with a subset of HTML, but there isn't really any reason to choose it, except for "I'm used to it". Better choose your native programming language. And if it is not better than a HTML subset, maybe consider choosing your language.