What's the "hierarchy" of a typical HTML document? -


i'm hoping clarify typical hierarchy or levels of html document are, starting upper-most "view." typical html document might include:

<!doctype html>   <head> </head>   <body> actual content here </body> </html> 

in mind, have browser window, , inside window, above html document renders , fills entire space allotted window. if have script tag referred window in:

<script>       var canvasel = document.getelementbyid("game-canvas");       canvasel.width = window.innerwidth;       canvasel.height = window.innerheight;       new asteroids.gameview(canvasel).startmenu(); </script> 

does "window" here refer browser window? if so, correct assume can group view top bottom browser window -> html -> head/body, etc?

as you've stated window outer object, in browser window.

inside document (window.document).

the document can obtain dom elements such head, body etc.

window.document.getelementsbytagname("body") 

the following article explains difference between window , document in bit more detail:

http://eligeske.com/jquery/what-is-the-difference-between-document-and-window-objects-2/


css tricks details typical structure of html5 document:

https://css-tricks.com/snippets/html/html5-page-structure/


so in short close hierarchy, missed out document.

window > document > head/body etc


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

Kivy: Swiping (Carousel & ScreenManager) -