3 ms·
Enterprise HTML
- wccrawford 16y agoI guess this is supposed to be a joke. I'm having trouble telling. "NEVER LEAVING AN IMG TAG UNCLOSED" - For instance, this one... I agree with. Why would you write bad/lazy HTML/XML when you don't have to? Just close it. The comments one is another. It can get ugly trying to determine where tags begin and end in any decent-sized site. Commenting them starts to make sense at a certain level of complexity.
- jerf 16y agoNot closing an img tag is not lazy HTML; it's actually correct HTML. HTML bans closing img tags! (At least some versions still in use, I haven't exhaustively checked them all.) See http://www.w3.org/TR/REC-html40/struct/objects.html#h-13.2 http://www.w3.org/TR/REC-html40/struct/objects.html#h-13.2 , right below the declaration of the tag: "Start tag: required, End tag: forbidden" Of course, including them doesn't do anything bad, but they're still not supposed to be there. (Nor should you <img src="..." />, that's an illegal empty attribute called "/".) There are a lot of misconceptions about what standards-complaint HTML is. For example, before I went and looked up the link I just gave, I thought they were optional. Nope. XHTML is a different story, of course, but you didn't say XHTML. Probably because you're not using it. Nobody sane does.
- chc 16y agoIf you agree that code is good, you need to bone up on your HTML. <img> tags are self-closing in all versions of HTML (as far as I can recall), and the end tag is specifically invalid in later versions. In XHTML, you can write it that way, but using the self-closing syntax (<img/>) is more efficient and readable. A closing <img> tag is wasteful at best and invalid at worst.