+ 3

If I put <p>tags outside of the head and body section it should show the error but it runs perfect .why

why.plz explain.

13th Dec 2016, 6:57 AM
Javaid Ahmad
Javaid Ahmad - avatar
2 Réponses
+ 7
Web browsers try their best to display webpages, even if there's errors in their HTML code. It's best to make sure your code is free of errors, though, even if it displays as you want.
13th Dec 2016, 7:35 AM
Tamra
Tamra - avatar
+ 2
@Tamra: Right; web browsers take a best-effort approach. @OP: the code I just linked to you to in another question doesn't even contain the HTML title, head and body tags; the HTML interpreter just does its best (and though broken it still functions). However...the timing glitch we were trying to solve might be because the tags were all missing; those tags help the browser determine when to run script, and I cheated on their code by putting their scripts at the end of the HTML; essentially the end of the body. If the code followed the document object model, we may have had more reliable results but the task here stopped as soon as something ran.
13th Dec 2016, 9:04 AM
Kirk Schafer
Kirk Schafer - avatar