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


  • JuanMa Ruiz   March 8, 2012, 2:09 p.m.

    Ey! I wrote this in html mode.

    Here is my assigment

  • Justfinethanku   March 1, 2012, 8:52 p.m.

     Here's my homework! 

    Alright, I think I've got the hang of this, but I'm not all to sure about the "<hgroup>" tag.

    Do you only use "<hgroup>" when you have two headers DIRECTLY following each other or simply when you are using more than one header?

    Let me know if it's correct in the assignment, I'll fix it if it's not. 

    htmlpad.org/homework2/

    Link to homework assignment

  • joe palmer   March 1, 2012, 9:07 p.m.
    In Reply To:   Justfinethanku   March 1, 2012, 8:52 p.m.

    Looks good- hgroup tag is for headers directly following each other.Here is an article on that with  examples. When using view source you'll see it time to time, that attention to detail pays off in how things show on user agents like phones.

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

  • blankenship.151   Feb. 20, 2012, 7:07 p.m.

    Here is my assignment.

    Task #4
  • joe palmer   Feb. 20, 2012, 7:39 p.m.
    In Reply To:   blankenship.151   Feb. 20, 2012, 7:07 p.m.

    Like the comments especially!

  • Carlos   Feb. 11, 2012, 4:57 a.m.

    No me he esforzado mucho. Solo he añadido un <h2> a mi primer ejercicio

    htmlpad.org/Beticos2/

  • Julio Garcia   Feb. 10, 2012, 12:01 p.m.

    I just finished task #4, basic markup. I did the my CV, short version. See the result.

  • Kronosaurus   Feb. 3, 2012, 1:51 p.m.

    Here is my work

  • Jack   Jan. 30, 2012, 3:07 p.m.

    Hi all, nice to be in the same workgroup with you. Here is my brief resume http://htmlpad.org/resume/

  • J R Bennett   Jan. 23, 2012, 9:28 p.m.

    Hey all, great to be a part of the study group!

    Here's my first task.

    Cheers - JRB

  • titos   Jan. 22, 2012, 12:02 p.m.

    Here is my code for assignment 1:

    http://htmlpad.org/assignment1/

  • joe palmer   Jan. 22, 2012, 1:28 p.m.
    In Reply To:   titos   Jan. 22, 2012, 12:02 p.m.

    You got it TItos! I looked at your code by holding down control and hitting the u key in firefox, other browsers go to view source in the tool bar. You can seee anyones work here like that, or any web site also. It is a great way to see how things were done.

    Everyone is looking good this week, do not feel bad if I did not get to you personally smiley.

  • AndyBKK   Jan. 13, 2012, 11:48 p.m.

    Here is the link to my fist task

    Hello HTML

  • Jay   Jan. 13, 2012, 8:30 a.m.

    Below is the link to my first task:

    http://www.jayokey.net/html5/task01.html

  • Tim   Jan. 11, 2012, 11:50 a.m.

    After watching for one whole year, I believe I am now ready to kick in and participate.

    Please take a look.  I tried to break away from the basic and add a little more extra to the page.

    http://www.aprenderebom.com.br/p2pu/P2PU_Lesson0001.html

    Awaiting comments?

    timotheonb

  • joe palmer   Jan. 11, 2012, 12:10 p.m.
    In Reply To:   Tim   Jan. 11, 2012, 11:50 a.m.

    The tavern sign says free beer tomorrow, but tomorrow never comes! Good.

  • Anonym   Jan. 11, 2012, 5:56 p.m.
    In Reply To:   Tim   Jan. 11, 2012, 11:50 a.m.

    According to w3c - the main international standards organization for the World Wide Web, the best practice concerning the <html> tag is to "always declare the default language for text in the page using attributes on the html tag, unless the document contains content aimed at speakers of more than one language."  So, add the lang attribute to your <html> tag (ie.  <html lang="en">).

    Another thing I want to point out is that you should always declare the document character encoding type.  Use utf-8 unless you need to use unusual characters, such as Chinese, Thai, etc.  To do this, add <meta charset="utf-8"> right after the <head> tag.  Then you are good to go.

    Other than that, your code looks crisp and clean.  Good job! demian

  • Thunderspud   Jan. 11, 2012, 8:58 a.m.

    Here is the practice document.

     

    http://htmlpad.org/thunderspud/

  • Anonym   Jan. 10, 2012, 1:14 p.m.
  • Russell   Jan. 10, 2012, 12:40 p.m.

    Task DONE

    http://htmlpad.org/rustle/

    Rustle

  • José González   Jan. 10, 2012, 6:25 a.m.

    This is my practise: http://htmlpad.org/kikofreakk/

  • Anonym   Jan. 10, 2012, 4:22 p.m.
    In Reply To:   José González   Jan. 10, 2012, 6:25 a.m.

    ¡Bien hecho!

    When you are making a web page in Spanish, you should specify the lang attribute to reflect that you are writing your page in Spanish.  To do that, you just need to add the following line below <!doctype html>:

    <!doctype html>

    <html lang="es">

    If you are making a website in English, change es to en.