I’m creating a website and I have the following structure:
<body> <div class="container"> <?php require_once('includes/header.php'); ?> <?php require_once('includes/main.php'); ?> </div> <?php require_once('includes/footer.php'); ?>
It’s working normal, but I do not know if I’m doing it right, the footer is outside the container div, if I put it inside it it’s not in the bottom of the site. I would like to know of those who know the development of websites the best structure for the development of websites.
The recommended structure for an HTML5 page in your case might look like this:
<!DOCTYPE html> <html> <head> <title>título da página</title> </head> <body> <nav>menu principal</nav> <header> <?php require_once('includes/header.php'); ?> </header> <main> <?php require_once('includes/main.php'); ?> </main> <footer> <?php require_once('includes/footer.php'); ?> </footer> </body> </html>
The “NAV” tag can stay within “HEADER” if you prefer. So your code will be more semantic and using html5 tags facilitates indexing by search engines. Regarding the footer, there are several ways to keep it fixed at the bottom of the window, here are 5 ways to do this.
The default structure for a
html document is as follows:
<!DOCTYPE><!--Document Type Definition--> <html> <head>Meta dados</head> <body>Conteúdo</body> </html>
body you can set up various type of layout … Where I believe (I have no sources) there is a sequence, being
footer , but this can vary a lot depending on the DTD and other details that make each singular purpose …
Anyway you can use one of many validators, for example: validator.w3.org
And here you can see information about the global standard.