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


  • Aurora   Nov. 7, 2011, 4:45 a.m.

    Below is a link to my very basic HTML page.

    http://dl.dropbox.com/u/43651344/HTML5%20course/html5_assignments.html

     

    I haven't been able to figure out how you link to a style sheet using drop box so I'll have to find out a better way to upload future examples.

     

    Aurora

  • altivium   Nov. 7, 2011, 5:07 a.m.
    In Reply To:   Aurora   Nov. 7, 2011, 4:45 a.m.

    Hello I have two point of error

    HTML4:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

    HTML5:

    <!DOCTYPE html>

     

    Charset

    HTML4:

  • Jo Meyertons   Oct. 27, 2011, 2:02 p.m.

    http://dl.dropbox.com/u/6340482/education.xhtml

    Gonna skip some of this as I already know it well - moving on to multimedia.

  • jenEliz   Oct. 16, 2011, 5:06 p.m.

    OKAY!  I finally got this to work after many technical issues .... :

     

    Basic Markup Assignment

     

    enjoy :)

  • joe palmer   Nov. 15, 2011, 6:39 p.m.
    In Reply To:   jenEliz   Oct. 16, 2011, 5:06 p.m.

    Wow, never expected that, very clever!

  • Brylie Oxley   Nov. 15, 2011, 11:36 p.m.
    In Reply To:   jenEliz   Oct. 16, 2011, 5:06 p.m.

    Wow! Those are really great pages smiley

    Interesting color scheme on the Witches page wink

  • Mike   Oct. 12, 2011, 12:28 a.m.

    Added a second section to my original index.html. 

     

    Also utilized <nav> in this example. The fixed anchor nav at the top will jump you to it's corresponding section. 

    http://michaelmcneive.com/html5/

  • Stavros   Oct. 17, 2011, 2:29 a.m.
    In Reply To:   Mike   Oct. 12, 2011, 12:28 a.m.

    Nice one Mike! Great work.

  • Stavros   Oct. 9, 2011, 4:06 p.m.

    I think I overdone it on the last task (HTML basic). Anyway, I have made 3 pages connected with links. On the first one I have put h1 h2 p em strong ul ol and a tags. On the second on I have put a pic and 2 links and on the 3rd one I have put a table.

    Here is the link:

    http://dl.dropbox.com/u/4230190/courses/index.html

     

    PS dropbox public folders work good for me. Does it work for you too?

  • joe palmer   Oct. 9, 2011, 7:53 p.m.
    In Reply To:   Stavros   Oct. 9, 2011, 4:06 p.m.

    I also prefer Dropbox, code looks great!

    I never saw anyone elese do this with lists, she nested some, check it out...

    http://nurianadalrovira.bz.cm/p2pu/html5/02_lists.html

     

  • Stavros   Oct. 10, 2011, 12:45 a.m.
    In Reply To:   joe palmer   Oct. 9, 2011, 7:53 p.m.

    Thanx Joe.

    `I appreciate your comments. I'm nesting some on my lists now. I also liked that she added nod names to move inside the page. I will add that too.

  • EnD   Oct. 9, 2011, 9:59 a.m.

    Hi,

    my basic markup can be found here:

    http://htmlpad.org/BasicMarkup/

    looking forward for the next task

    EnD

  • Antonio   Oct. 2, 2011, 1:22 p.m.

    For some reason Chrome displays the text in the HEAD tag, this is what I have:

     

    <!DOCTYPE html>
     
    <html>
     
    <head>Título: head tag</head>
     
    <body>
     
    <h1> Título 1 (h1) </h1>
     
    <h2> Título 2 (h2) subsección </h2>
     
    <p> Un párrafo </p>
     
     
     
     
     
    </body>
    </html>
  • Claudio Pinho   Oct. 19, 2011, 7:20 a.m.
    In Reply To:   Antonio   Oct. 2, 2011, 1:22 p.m.

    Hi Antonio!

    Did you already discovered what's wrong with the code?

    If not, here's the answer:

    <!DOCTYPE html>
    <html>
    <head>
    <title> Título: head tag </title>
    </head>
     
    <body>
    <h1> Título 1 (h1) </h1>
    <h2> Título 2 (h2) subsección </h2>
    <p> Un párrafo </p>
    </body>
    </html>
     
    Best Regards.
  • Logan   Sept. 21, 2011, 10:57 a.m.

    Joe, thanks for posting that link to Mozilla's page about learning to build sites. The challenges look like they will be good practice once I know a little more. 

    Here's my assignment. 

  • joe palmer   Sept. 21, 2011, 11:59 a.m.
    In Reply To:   Logan   Sept. 21, 2011, 10:57 a.m.

    Looking good Logan,

    will be busy for the rest of the day (on the road) , keep up the good work, you will be surprised how fast it adds up!

  • Luca Serpietri   Sept. 21, 2011, 7:42 a.m.
  • joe palmer   Sept. 21, 2011, 9:57 a.m.
    In Reply To:   Luca Serpietri   Sept. 21, 2011, 7:42 a.m.

    Nice going Luca,

    Here is something interesting someone did with lists

    http://nurianadalrovira.bz.cm/p2pu/html5/02_lists.html
     


     

  • Luca Serpietri   Sept. 21, 2011, 10:53 a.m.
    In Reply To:   joe palmer   Sept. 21, 2011, 9:57 a.m.

    this is very interesting indeed! since I'm going through the course with the same pad in order to keep track of the sections and my progress, I'm updating my link to avoid confusion.

    here's the basic markup one

  • Claudio Pinho   Sept. 21, 2011, 7:24 a.m.

    My example is here: http://htmlpad.org/ldesigntask4/

  • joe palmer   Sept. 21, 2011, 7:38 a.m.
    In Reply To:   Claudio Pinho   Sept. 21, 2011, 7:24 a.m.

    Good work, feel free to play with the assignment also- to add and experiment.

    Keep going Claudio!

  • Dar   Sept. 1, 2011, 12:24 p.m.

    Here's my basic markup: http://etherpad.mozilla.org:9000/ep/pad/view/ro.eGtbHttSd7e$/rev.20

    fun stuff

  • Michael Clark   Aug. 20, 2011, 2:05 p.m.

    Here's my basic markup, I hope this works, never used dropbox before. I saw that someone else used it I love the idea behind it.

    http://dl.dropbox.com/u/38817193/index.html

  • joe palmer   Aug. 21, 2011, 10:01 a.m.
    In Reply To:   Michael Clark   Aug. 20, 2011, 2:05 p.m.

    Works good!

  • skullkandy09   Aug. 20, 2011, 10:52 a.m.

    Here's my HTML @ pastebin - http://pastebin.com/ySBugL5p

  • joe palmer   Aug. 20, 2011, 11:36 a.m.
    In Reply To:   skullkandy09   Aug. 20, 2011, 10:52 a.m.

    http://dl.dropbox.com/u/31656724/pizzza.html

    you missed the closing tag on body, but great start, more later, I have to go now. Hit the link, than hit view from the toolbar, view source (or just cntrl+u in the new Firefox) to see how you want to tab out sections to easily look for that.

  • joe palmer   Aug. 20, 2011, 1:34 p.m.
    In Reply To:   skullkandy09   Aug. 20, 2011, 10:52 a.m.

    http://css-tricks.com/121-what-beautiful-html-code-looks-like/

    Look at this on the "indentation" label on the left, it will expand out to see better, keep going now. off to a good start.

  • joe palmer   Aug. 20, 2011, 1:37 p.m.
    In Reply To:   joe palmer   Aug. 20, 2011, 1:34 p.m.

    https://developer.mozilla.org/en-US/learn
     

    Probably should have put that up too, good stuff.

  • klaus   Aug. 17, 2011, 8:41 a.m.

    my basic html file is here:

    http://pastebin.com/Zgffeavm

    ;-)

  • Michael Sturgeon   Aug. 14, 2011, 2:39 p.m.

    Here is my completion of the Basic Markup assignment

    http://htmlpad.org/cmsturgeon/

  • Steve   July 20, 2011, 10:29 p.m.

    Hi, My assignment is here: http://pastebin.com/u/shemric

  • mook   July 18, 2011, 10:31 a.m.

    here's my html code.

     

    <!DOCTYPE HTML>
    <html>
    <head>
    <title>Hello HTML5</title>
    </head>
     
    <body>
    <h1>Welcome!</h1>
     
    <h2>Please enjoy yourself</h2>
     
    <p>The quick brown fox jumped over the lazy dog.</p>
    </body>
    </html>