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


  • Siulka   May 6, 2012, 11:44 a.m.

    Here is my new website.

  • Nick   May 6, 2012, 6:25 a.m.

    Here is my initial html page for p2pu

  • Hibby73   May 5, 2012, 3:49 p.m.

    This my homework for the Basic Markup task.

  • Vinicios   May 4, 2012, 5:55 p.m.
  • Anonym   May 2, 2012, 6:38 a.m.

    Thanks.

    Assignement: http://htmlpad.org/Newbie/

  • Trey Brister   May 1, 2012, 7:19 a.m.

    Link to the assignment http://jsfiddle.net/N3M6x/

  • Jenifferhomes   May 3, 2012, 8:17 a.m.
    In Reply To:   Trey Brister   May 1, 2012, 7:19 a.m.

    at times there are tasks are no longer in the proper order. This makes it difficult for new students. Does anyone know how to put them back in the proper order? And does anyone remember the right order of the tasks (a new student asked me).

  • Pau Company   May 3, 2012, 11:04 a.m.
    In Reply To:   Jenifferhomes   May 3, 2012, 8:17 a.m.

    En la parte superior de P2PU, hay un pequeño menu en donde encontraras la lista de tareas que ya has realizado y las que te faltan por realizar: el link directo es:

     

    On Top of P2PU, hay United Nations Small menu you'll find the list of tasks already done and you have left to be done: the link directory is:

    https://p2pu.org/es/groups/html-introduction/

  • E.Mosso   April 28, 2012, 2:53 p.m.

    here's my completed task

  • jacobbundren   April 28, 2012, 2:33 p.m.

    Here is my first homework assignment. 

  • Jean-Baptiste Carré   April 28, 2012, 4:29 a.m.

    Assignement done here.

  • berenhena   April 22, 2012, 6:52 p.m.

    HOMEWORK!!! ... Right Here

  • Anonym   April 12, 2012, 11:50 p.m.

    Here's my homework assignment. Sorry about double posting. I was having a hard time figuring out how to share my assignment using htmlpad.org instead of dropbox!!

  • joe palmer   April 17, 2012, 2:26 p.m.
    In Reply To:   Anonym   April 12, 2012, 11:50 p.m.

    Look at your doctype too Eraq, think you forgot to hit the shift key. <!DOCTYPE html>

  • Anonym   April 18, 2012, 5:21 p.m.
    In Reply To:   joe palmer   April 17, 2012, 2:26 p.m.

    Yes I did. Thank you for noticing. Will update my post shortly

  • Pau Company   April 12, 2012, 4:13 a.m.

    Bueno, aqui teneis mi trabajo:

    http://paucompany.es/ejercicioshtml5/marcadobasico.html

     

    Espero que me digais algo. Un abrazo

  • joe palmer   April 17, 2012, 2:22 p.m.
    In Reply To:   Pau Company   April 12, 2012, 4:13 a.m.

    Looks good Pau, just change your doctype from <!DOCTYPE HTML> to <!DOCTYPE html>. Upper case will work but can give you problems down the road, all HTML tags should be lower case.

    From the link provided: In XHTML5 the DOCTYPE must be a case-sensitive match of the string "<!DOCTYPE html>". This is because in XHTML syntax all HTML PUBLIC are required to be in lower case, including the root element referenced inside the HTML5 DOCTYPE.

    A bit  wordy for us but provides some understanding, thanks and keep going.

    http://en.wikipedia.org/wiki/Doctype

  • Pau Company   April 17, 2012, 5:02 p.m.
    In Reply To:   joe palmer   April 17, 2012, 2:22 p.m.

    Hola Joe:

       En primer lugar, darte las gracias por el interes que tomas en mi codigo. Ya he corregido el detalle que me comentabas donde debo cambiar <!DOCTYPE HTML> por  <!DOCTYPE html>, asi como la explicación que me incluias en el link a la WIKI. Me gustaria que miraras el codigo ya que he añadido <html lang="es" xml:lang="es">, pero no estoy seguro de que en HTML5, sea igual que en la versión anterior. Muchas gracias por todo. Atentamente:

     

    Pau Company

     

    Hi Joe:

        First, thank you for the interest you take in my code. I've corrected the detail that you told me where I should change <! DOCTYPE HTML> by <! DOCTYPE html>, as well asthe explanation I including current on the link to the WIKI. I would like you to look at the code and I added <html class="Apple-style-span" xml:lang="en">, but I'm not sure thatHTML5 is not less than the previous version. Thank you very much for everything.Sincerely,



    Pau Company

  • Jeremiah   April 11, 2012, 8:47 p.m.

    Here is my assignment on basic markup. It's simple but was effective for me.

  • flatpack   March 28, 2012, 7:20 a.m.

    Here is my page with a little borrowed and edited CSS.

    http://htmlpad.org/p2pueditor/

  • anderson620   March 16, 2012, 4:45 p.m.

    For everyone asking what the point of the <hgroup> tag is, well, I don't konw either. It seems a bit superfluous. But I did find this article which explains it a bit.  

     

    Hope it helps someone.

     

    http://html5doctor.com/the-hgroup-element/

  • anderson620   March 16, 2012, 4:16 p.m.

    Here is the link to my assignment.

     

    http://htmlpad.org/1stExample/

  • Unknown   March 15, 2012, 4:17 p.m.

    Here is the link to my homework assignment.

    Homework