Question about Body tag in HTML

Hey! I am a beginner learning through coding my own website. I am making a landing page and therefore have all these different elements such as a menu bar at the top, a button that is going to be my logo in the upper left hand corner, as well as big text in the center, then a button below that will link to another page in my portfolio website. Below that I am planning on having a grid of photos that pertain to my different projects that will also be links to my projects on the project page and more! etc.
My question is: Does each section within a landing page need to have a body tag before and after each section of functions/elements that I want to have? Or should all of the functions and elements on my landing page all be encapsulated within the same single body tag? Like I said, I’m a newbie and I’m learning through doing! I’ve done some codeacademy beginner courses on html and css but coding a website for the first time is a whole other ballgame.

A webpage only needs one body element. That single body element will contain every element that will be visible on the browser.

@kevcomedia That makes so much sense! Thank you! And for each page within a website i need a different file, right? Right now I’m just working on the html.index and the css.index files— silly questions, but how do you distinguish file types within one project/ie one website? or is of the content of a website in one file? like say all of the html of one website on one html.index file within the project folder? I’m a newbie but like i said i appreciate any answers you can give back! :slight_smile:

The main page should always be named index.html, the rest can be named whatever you’d like (or what is relevant to your site). As far as all the related files go, you’ll need a master directory (main folder) where all your website’s files live. You could also have other folders within the main directory to better organize certain aspects of your website such as .html, .css, .js or images.

I did some searching online to find an example of a file structure of a website and I found this:

It gives some explanations too which I found to be useful.

1 Like