+ 3

Can you run a browser without an html, head and body tags? Why are the lessons CSS?

i tried it by myself and when I see the codes, it's just a mere <p> or <h1>, there's no html, body, and head tags.

6th May 2017, 8:11 AM
Jan David Afalla
Jan David Afalla - avatar
2 Respuestas
+ 7
Yes you can.... But prefer to at least add <body> tag For working well to javascript
6th May 2017, 10:37 AM
Yanothai Chaitawat
Yanothai Chaitawat - avatar
+ 3
Really, in theory you cannot, in meaning that's invalid html source code... ... but, thanks to html permissivity, browsers have behaviour to display an html document the best possible in whatever case. So, technically, you can, but the browser rebuild a minimal html document structure required. Open such incomplete code in a browser, and explore the DOM with the developers tools: you will see that the browser display a complete html document ^^ However, by this way, you cannot be sure of how the browser will decide to "correct" your incomplete/incorrect code :P ( except for few behaviours very accuratly described in w3c specifications, as <table> structure, which can be predictable if you well known the rules of correction ;) )
6th May 2017, 10:54 AM
visph
visph - avatar