what's in an
html file?


all of the things

  • Doctype
  • HTML bits
    • Head of the document
      • Information about the document
    • Body of the document
      • Stuff everyone can see


doctype

<!DOCTYPE html>

<!DOCTYPE html>


what it is

  • Browser instructions
  • Version number

<!DOCTYPE html>


what it is not

  • An HTML tag
  • Based on SGML

<!DOCTYPE html>


remember

  • It must be the first declaration in your HTML document.
  • Don't forget to include it. It's that important.
  • Always include it.
  • Include it as the first thing.
  • Seriously, the first thing.
  • In every HTML document you write.

in the before-time

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">


html tag

<html></html>

wrapper

  • Tag that wraps all the HTML bits
  • It is like the super-parent
  • Comes directly after the DOCTYPE
  • Should be the last line of code you write


head

<head></head>


what must go inside

  • The title


what may go inside

  • Scripts
  • Styles
  • Meta information
  • Other stuff


title

<title></title>


not rocket science

  • The page's title goes inside
  • That's it


body

<body></body>

<body></body>


body is a
wonderland

  • Full of HTML elements
  • Contains everything we see on the page
  • Can be styled just like all other elements


Exercise

Write from scratch the code from the first slide.

document

By rmion

document

  • 603