Define the Head and Body of an HTML Doc

Define the Head and Body of an HTML Doc
0

#1

**Tell us what’s happening:**i got the code but i’m exactly didn’t understand the purpose of body and head tags.
what will happen in the code if we don’t use it?

Your code so far


<!DOCTYPE html>
<html>
  <title>The best page ever</title>
  
  <h1>The best page ever</h1>
  <p>Cat ipsum dolor sit amet, jump launch to pounce upon little yarn mouse, bare fangs at toy run hide in litter box until treats are fed. Go into a room to decide you didn't want to be in there anyway. I like big cats and i can not lie kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff. Meow i could pee on this if i had the energy for slap owner's face at 5am until human fills food dish yet scamper. Knock dish off table head butt cant eat out of my own dish scratch the furniture. Make meme, make cute face. Sleep in the bathroom sink chase laser but pee in the shoe. Paw at your fat belly licks your face and eat grass, throw it back up kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
  
</html>  

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/responsive-web-design/basic-html-and-html5/define-the-head-and-body-of-an-html-document


#2

With respect to actually rendering the basic HTML, nothing, because browsers have been built to parse HTML that is effectively garbage to account for people making errors (like missing off end tags) when writing the code. But generally loads of ancillary things will break (things like CSS and JavaScript and accessibility tools and so on expect that you have written your HTML in a sane manner).

Stuff in the head should not be rendered on the page (page title, page description, the text encoding, links to stylesheets etc). Stuff in the body is the page that actually renders, the bit the users see.

Basically, don’t miss them off, because any CSS/JavaScript that you haven’t written specifically to take into account that you’ve decided to ignore HTML standards will break, accessibility tools will break (screen readers, for example, expect that the page has something to read, and no body means nothing to read), browsers won’t correctly read meta information about the page, and so on and so forth

Edit: also lots of people have entertained themselves by exploring the minimum possible html needed, for example: