Quote:
Originally Posted by cscgal
As far as I am concerned, every single tag that's opened must be closed. If there is no reason for a tag to be closed (such as an image tag or line break) then it should be self closing by ending with a slash as in <tag ... />. Just because it doesn't error out doesn't mean it's okay to do. I feel a C++ void main() lecture coming on ...
---
What often happens is web browsers will implicitely add a closing tag when it is impossible for it to remain open. It's impossible to remain in the <head> section once the <body> has started, so let's implicitely close the head tag before the body. This same thing happens with lists. A lot of people type <li> at the start of a list element without closing it as so:
<ul>
<li>One.
<li>Two.
</ul> This is wrong, but it's impossible for something to be a part of two list elements of the exact same list, so a web browser will implicitely close the first list element before moving on to the second one. If you get into this habit, you'll inevitably not close something that technically could remain open (and therefore the browser won't be nice enough to close it for you), even though it's incorrectly nested or not what you intended.
|
I agree wholeheartedly - I was just suggesting a way to check on when it
might be safe to leave out a closing tag for those who wish to do that. The reasoning being that if Google can get away with it chances are it works in most browsers.