Many friends have told me that she/he has code mysophobia, that is, if she/he is asked to write XHTML, she/he is never willing to add additional tags. To give a simple example, I believe many people have seen it from many places:
The following is the quoted content: <div id="nav"> <ul> <li></li> <li></li> ... </ul> </div> |
Many people, including many industry experts, suggest that you just write like this:
The following is the quoted content: <ul id="nav"> <li></li> <li></li> ... </ul> |
Of course, I personally appreciate the second way of writing. Yes, it is concise, clear, and semantic. But wait, which one provides more control if you need to style it? Obviously, the first one.
Then, this question becomes a little bit maddening. In a word: Do you give priority to structure (markup) or presentation (presentation)? I believe that in today's bad times, performance first is the first rule. For many people with ideals, including me, in the end, in order to achieve performance needs, tag soup is actually unavoidable.
So, this can only be a matter of degree. Don't abuse it. It's not considered abuse, and there are no guidelines. My personal rule of thumb is this: if you use more than three levels of wrappers (wrappers?) to achieve a performance requirement, you should stop and think about it. Even though it's a bit old, I recommend you take a look at some interesting discussions on SimpleQuiz.
Why is this happening? Because nothing is perfect. Just imagine, if CSS could provide more rules to control elements on the page, it might not be so embarrassing. For example, if background-image supports images with four different directions of trlb (top, right, bottom, left), we don’t have to rack our brains to deal with rounded corners; if it supports generating elements from the page, such as content, then it can also be greatly reduced. The use of tags...
XHTML? joke. In fact, not many people are using XHTML so far, and everything is self-deception. XHTML is Dead! XHTML is xml and has all the advantages of xml, but what we see now is text. If text is treated as xml, this is harmful (Sending XHTML as text/html Considered Harmful).
Although we all indicate on Doctype that we are using XHTML, in fact we are all using HTML. This is reality. Otherwise, how could those ill-formed pages that are full of errors be displayed in tolerant modern browsers... No wonder, XHTML 1 is just an improvement of HTML 4. However, the future XHTML 2 is not backward compatible, and I don't know why we need to use XHTML 1. Also, don't argue with me about accessibility, HTML 4, which separates structure and presentation, is not any different from XHTML 1.
So, maybe, the point of using XHTML 1 is to say that we already have this idea and are ready for XHTML 2 in the future.
This is why I strongly recommend using the HTML 4.01 Strict Doctype. From a company/enterprise perspective, it is not easy to require the entire team to have the idea of web standards and implement relevant principles. Various ideas left over from the last century are still stubbornly resisting. If you really use XHTML 1, many JavaScript scripts that are only compatible with HTML will fail, editing an inadvertent unescaped character will cause the entire page to error (xml parsing error), and so on. To avoid problems, perhaps, HTML 4.01 Strict Doctype is the best choice now.