Home > Sample chapters

Setting Up the Document Structure in HTML5

Key Points

  • To specify HTML5 as the document type, add <!DOCTYPE html> at the beginning of the file.

  • All the HTML coding in a document (except the DOCTYPE) is enclosed within a two-sided <html> tag.

  • The <html> and </html> tags enclose the <head> and <body> sections.

  • The <head> area contains the page title (<title>) and any <meta> tags. The <body> area contains all the displayable text for the page.

  • Enclose each paragraph in a two-sided <p> tag. Most browsers add space between paragraphs when displaying the page.

  • To create a line break without starting a new paragraph, use the one-sided <br> tag.

  • When coding for XHTML, end one-sided tags with a space and a slash ( /). The space is required for recognition in HTML, and the slash is necessary for recognition in XHTML.

  • Use <meta> tags in the <head> section to indicate keywords and the document encoding language.

  • Use the <title> and </title> tags to enclose the text that should appear in the browser’s title bar. Place these in the <head> section of the file.

  • To publish pages directly to a server, you can use an FTP utility or the FTP capability built into Windows, or (with some tools) you can save files directly to a server. However, Notepad does not offer this capability.