This course will become read-only in the near future. Tell us at community.p2pu.org if that is a problem.

Basic Markup


Learning Objectives

  • Describe the general structure of a document. I.e. what are some common elements found in a magazine article, newspaper page, or other common printed materials.
  • Identify key structural, or semantic, elements of several common documents.
  • Label a printed page or article with related HTML elements.
  • Memorize the HTML5 Doctype.
  • Memorize the UTF-8 charset meta tag.
  • Create a page outline using HTML tags.
  • Distinguish content markup from presentation.

Task Materials

HTML tags are used to mark structural elements of a page. Structural elements include paragraphs, headers, articles, images, and other aspects of hypertext documents.

HTML tags are surrounded by less than ( < ) and greater than ( > ) characters. There will typically be an opening and closing tag that surrounds the corresponding page content. For example, to denote an HTML document you surround the entire page with opening and closing HTML tags:

<html>
... Page content ...
</html>

The only difference between many opening and closing tags is that closing tags have a forward slash ( / ) preceeding the tag text. As an aside, some tags are self closing. Self closing tags look like this:

<br />

Lets take a look at several basic elements of the HTML. We will start off by creating a simple resume or other document of your choice. The elements we will start with include:

  • <!DOCTYPE html>
  • <head>
  • <meta>
  • <body>
  • <h1>, <h2>, etc.
  • <p>

With this limited set of elements we can begin to construct our own HTML resume.

To begin, create a new, empty text file on your local computer or on HTML Pad.

Once you have a blank document, add a DOCTYPE to the beginning of the document. Doctype is short for 'Document Type Declaration' and associates a particular document with a formally defined mark up definition. Our doctype is html. When a browser, such as Mozilla Firefox, parses a document, the doctype declaration describes the possible tags that the browser may encounter. The HTML5 doctype is below:

<!DOCTYPE html>

After the document type has been declared, we can go ahead and open our <html> tag, which will hold sub-elements of the document:

<html>

Be sure not to close the <html> tag yet, we will place the </html> tag at the end of the document.

Now we will place the document header with a <head> tag. The <head> tag is a container for elements such as the page title, CSS for layout, and JavaScript for dynamic elements. This course does not cover those topics but there are study groups forming here at the School of Webcraft.

<head>

We can insert the page <title> inside of the <head> like so:

Our document will contain encoded characters, in our native language, that web browsers will need to display. It is important for us to tell the browser what character encoding to use. The unicode (UTF-8) standard contains over one million characters from languages around the earth. We set our character encoding as UTF-8 using the <meta> tag.

<meta charset="UTF-8" />

Next we close the <head> tag:

</head>

In an HTML document, the <body> is usually located below the <head>. The body is a container for most of your content. Lets open the body container.

In the body, we will typically have page sections and paragraphs of content. The sections are usually seperated by headers. Lets create a couple of header sections:

<h1>Header 1</h1>
<h2>Header 2 (sub-section)</h2>

The headers are hierarchical and higher number header levels are generally sub-sections of the lower numbered headers. In this example, the <h2> is a sub section of the <h1> element.

The <hgroup>  tag is used for when <h> tags are used consecutively after each other.

The final step on this short trip through the basic HTML tags is the often used paragraph tag <p>. Paragraph tags are used to designate paragraphs within a document. For example:

<p>The quick brown fox jumped over the lazy dog.</p>

At the end of your document, be sure to close the <body> and the <html> with:

</body>
</html>

As you can see, the HTML elements are designed to be easily understood by humans, as well as parsed by computers.

Task Assignment

Please post a working HTML document online. You can do so by posting on HTML pad, pastebin, or any other online code pasting/hosting website. If you have your own web hosting feel free to post your HTML files there, or any other reasonable place you know of. Submit a link to your task by replying to this task.

Task Discussion


  • Carlo Coronacion   Oct. 3, 2012, 2:57 a.m.

    Readign html5 introduction because sometimes we missed some fundamentals

  • Robogirl   Sept. 26, 2012, 8:06 p.m.

     

    The code for my first html page is below.

    See my page published here. Thanks, Thimble, for the web space, and NASA/JPL-Caltech, for the image!

    <!doctype html>
    <html> 
      <meta charset="UTF-8" />
      <head>
        <title> Curiosity Rover </title>
      </head>
      <h1> Curiosity Rover (aka MSL) </h1>
        <body>
        <p>Resources at this site include diagrams, actual pictures sent from Mars, videos, websites, science updates, and games.</p>
      </body><h2> Images </h2>
      <image> X </image>
       <h2> Videos </h2>
       <h2> Websites </h2>
      <p> Here's a real website about Curiosity with several resources:
        http://www.nasatalk.com/collaboratives/robotics/mars-curiosity-rover.html
      </p>
    </html>
     
    What my image would look like if "how to attach an image" had been included in this lesson. Instead, I added X to represent it between <image> and </image> . Are those the right tags (also not in this lesson)?
     
    Image credit: NASA/JPL-Caltech.
  • Garrison Snelling   Sept. 19, 2012, 10:29 a.m.

    http://htmlpad.org/world-of-webcraft/

    And this is what I got:

     

    <!DOCTYPE html>
    <html>
    <head>
    <title>Hire Me</title>
    <meta charset="UTF-8" />
    </head>
    <body>
    <h1>Welcome to MoPad!</h1>
    <h2>Thank you, I feel at home.</h2>
    <p>This pad text is synchronized as you type, so that everyone viewing this page sees the same text.  This allows you to collaborate seamlessly on documents!<br />Please be cognizant of whether you are using a public pad or private/team pad, and take appropriate precautions with data you post here!</p>
    </body>
    </html>
     
  • mkII_gti_vr6T   Sept. 11, 2012, 11:17 p.m.
    Hello, Welcome to my Webpage

    The is a header yo


    This is a smaller header


    This is very basic

  • piscator   Sept. 4, 2012, 2:53 p.m.

    Here´s mine^^

    Does it work?

  • Tan Li Wei   Sept. 4, 2012, 2:13 a.m.

    Here's mine
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8"/>
    </head>
    <body>
    <h1>Hello</h1>
    <p>Nice to meet you!,</p>
    </body>
    </html>

     

  • GuyziB   Sept. 2, 2012, 10:10 a.m.

    Let's see if it works ...!

     

    http://htmlpad.org/P2PU-guyzib/

  • shuniata   Aug. 23, 2012, 8:14 a.m.

    Here is mine:

    http://htmlpad.org/Basic-Markup/

  • manypieces   Aug. 19, 2012, 1:39 a.m.

    Here's mine as a first example: http://jsfiddle.net/manypieces/UMWVn/

  • al read   Aug. 19, 2012, 1:41 a.m.
    In Reply To:   manypieces   Aug. 19, 2012, 1:39 a.m.
    Thanks for your message. I will be out of the office on annual leave until Monday 20th August If your enquiry is urgent, please SMS me on my mobile. Kind regards, Alan Read Head of Learning Technologies Learning Technologies Group Pearson UK +44 (0) 7703 750913 This email was sent by a company owned by Pearson plc, registered office at 80 Strand, London WC2R 0RL. Registered in England and Wales with company number 53723
  • Angel_hero   Aug. 16, 2012, 9:35 p.m.

    A little song for you all https://thimble.webmaker.org/p/oh5

  • al read   Aug. 16, 2012, 9:37 p.m.
    In Reply To:   Angel_hero   Aug. 16, 2012, 9:35 p.m.
    Thanks for your message. I will be out of the office on annual leave until Monday 20th August If your enquiry is urgent, please SMS me on my mobile. Kind regards, Alan Read Head of Learning Technologies Learning Technologies Group Pearson UK +44 (0) 7703 750913 This email was sent by a company owned by Pearson plc, registered office at 80 Strand, London WC2R 0RL. Registered in England and Wales with company number 53723
  • Paolo Vagnini   Aug. 14, 2012, 6:28 a.m.

    I've done some basic editing and the results can be viewed here.

  • al read   Aug. 14, 2012, 6:31 a.m.
    In Reply To:   Paolo Vagnini   Aug. 14, 2012, 6:28 a.m.
    Thanks for your message. I will be out of the office on annual leave until Monday 20th August If your enquiry is urgent, please SMS me on my mobile. Kind regards, Alan Read Head of Learning Technologies Learning Technologies Group Pearson UK +44 (0) 7703 750913 This email was sent by a company owned by Pearson plc, registered office at 80 Strand, London WC2R 0RL. Registered in England and Wales with company number 53723
  • Courtney Elizabeth   Aug. 13, 2012, 9:37 p.m.
  • al read   Aug. 13, 2012, 9:39 p.m.
    In Reply To:   Courtney Elizabeth   Aug. 13, 2012, 9:37 p.m.
    Thanks for your message. I will be out of the office on annual leave until Monday 20th August If your enquiry is urgent, please SMS me on my mobile. Kind regards, Alan Read Head of Learning Technologies Learning Technologies Group Pearson UK +44 (0) 7703 750913 This email was sent by a company owned by Pearson plc, registered office at 80 Strand, London WC2R 0RL. Registered in England and Wales with company number 53723
  • saravanan   Aug. 13, 2012, 3:09 a.m.

    Basic markup completed

    https://thimble.webmaker.org/p/ozw

  • al read   Aug. 13, 2012, 3:11 a.m.
    In Reply To:   saravanan   Aug. 13, 2012, 3:09 a.m.
    Thanks for your message. I will be out of the office on annual leave until Monday 20th August If your enquiry is urgent, please SMS me on my mobile. Kind regards, Alan Read Head of Learning Technologies Learning Technologies Group Pearson UK +44 (0) 7703 750913 This email was sent by a company owned by Pearson plc, registered office at 80 Strand, London WC2R 0RL. Registered in England and Wales with company number 53723
  • Colette   Aug. 3, 2012, 10:56 p.m.

    http://htmlpad.basicmarkup

    <!DOCTYPE html>
    <html>
    <head><meta charset="UTF-8"></head>
    <body><h1>Hello World</h1><h2>I'm here!</h2>
    <p>I am making this website using an online editor on an iPad which makes me pretty stoked!<p></body>
    </html>
     
     
  • Joanne   Aug. 3, 2012, 4:51 p.m.

     

     <!DOCTYPE html>
    <html>
    <meta charset="UTF8" />
    <head>HERE IS A SAMPLE PAGE</head>
     
    <body>
    <h1>Part One</h1>
    <p>Edit the pad on the right to build your HTML page (click the Create Pad button if necessary). Here's a simple page you can copy-and-paste into the pad to get started.</p>
     
    <h2>Part  One-A</h2>
    <p>Keep switching back and forth between the editor and the view to rapidly iterate on your design. Give the editor link to a friend if you'd like to collaborate in real-time!</p>
     
    <h1>Part Two</h1>
    <p>This is the second part of the web page, and should not be seen as a subsection of the first part. headers were styled using CSS, they would appear different from each other.</p>
     
    </body.
    </html>
  • Motlar   July 26, 2012, 6:11 p.m.

    First page created for this challenge: https://thimble.webmaker.org/p/8os

  • Marco Antonio González Gómez-Caro   July 26, 2012, 2:05 p.m.

    This is my first page. Very simple, but it is the very first one ;-)

    https://thimble.webmaker.org/p/8od

  • Michael Sturgeon   July 26, 2012, 8:32 a.m.

    Here is my first step in delving into HTML 5 -- so far, nothing new, but I am eager to see the new code... I think

    https://etherpad.mozilla.org/FirstHTML5Page