HTML Blox

Providing the building blox of the web.

  • HTML Blox Home
  • Blog
    • Design
    • Flash
    • General
    • HTML
    • Javascript
    • PHP
    • Programming
    • Web Servers
  • Forums
  • Where to Start?
  • Lessons
    • CSS
    • Design
    • HTML
    • Javascript
    • Programming
  • References
    • HTML
  • Resources
  • About
  • Contact
  • Go Green!

HTML Lessons

  1. Lesson 1 - The Basics
  2. Lesson 2 - Say Something!
  3. Lesson 3.1: Lay It Out! - Images
  4. Lesson 3.2: Lay It Out! - Divs & Spans
  5. Lesson 3.3: Lay It Out! - Tables
  6. Lesson 4: Don't Touch This!
  7. Lesson 5: Interact A Lil' With Flash
  8. Lesson 6.1: Forms to Fill - Form Basics
  9. Lesson 6.2: Forms to Fill - Inputs
  10. Lesson 6.3: Forms to Fill - Text Areas and Selects

HTML Reference

  1. DOCTYPE
  2. HTML Element

Links

  • W3C HTML 4.01 Strict Compliant
  • W3C CSS 2.1 Compliant
  • Web Standards Group Member
  • Follow us on Twitter
  • Number Overflow - Free Advanced Scripts and Tutorials
  • Azure Ronin Web Design - Professional Web Design and Development
  • XML Sitemap
  • U Comment, I Follow

Feeds

  • RSS 2.0 Feed
  • RDF/RSS 1.0 Feed
  • RSS 0.9 Feed
  • Atom Feed

Lesson 2 – Say Something!

del.icio.us Digg Blinklist reddit

The number one goal of nearly all websites is to provide some kind of information.

In HTML there are a number of ways to display this information. We’ll take a look at some of the most common ones in this lesson.

Paragraphs

The most basic way to write something is with a paragraph element (<p>). A paragraph is a way to easily organize your information into related, more easily digestible chunks, exactly how a book does.

To use the paragraph element, you simply open a paragraph, place the text you want inside of it, and then end with a closing paragraph tag, like so:

Code

<p>
  Hello World!
</p>

That would output “Hello World!” onto the screen. You, of course, would place the paragraph element within the body element in your page since it is something that is directly output to the screen.

Headers

The word Headers on this page is, unsurprisingly, a header. Headers, both in web pages and on other documents, is simply a short burst of text which describes the information below the text.

In HTML, there are 6 header elements, (<h1> through <h6>). Each of these elements, semantically speaking, is meant to be used to form a hierarchy, meaning that the <h1> should be found above <h2> and downwards.

Using the headers is identical to the paragraph element. You simply start with an opening header, add your text in between, and close with a closing tag, like so:

Code

<h1>
  This is an upper header.
</h1>

<h6>
   This is the bottom header.
</h6>

Headers are great for helping your viewer be able to tell what they are reading about.

Lists

Another way to display your information is to list it. HTML has three varieties of lists: unordered, ordered, and definition lists.

Unordered and ordered lists are used in exactly the same way, simply switching whether you are using <ul> or <ol>. The difference between the two is that in unordered lists, the actual order of the elements is irrelevant, and in ordered lists, the order is important. Unordered lists are typically rendered with some sort of bullet point, while ordered lists are rendered with some sort of number or letter.

They both require the use of a list item element (<li>) which is where the actual contents of the list is contained within. You place what you want to display for one line in a list item, and put all of your list items within either an ordered or unordered list. Here are some examples:

Code

<ul>
  <li>Something random</li>
  <li>Something else random</li>
  <li>Something else</li>
</ul>

<ol>
  <li>The first step</li>
  <li>The second step</li>
  <li>The third step</li>
</o>

You can control the symbol that appears next to each using CSS. There is also an HTML attribute which you can use, however, it has been deprecated in favor of CSS, so it is no longer proper to use it . We will cover the CSS in a future lesson.

The third type of list, the definition list, is a bit different from the other. It is meant to be used for definitions, or things similar in structure. Since a definition typically has a word and then it’s definition, the definition list is structured in that way. The element for a definition list is <dl> and it requires a closing tag. Within the definition list are pairs of definition titles (<dt>) and definition data (<dd>).

The definition title contains the thing we are defining, so you could think of it as the header of the definition list. The definition data contains the definition, or the text, so you can think of it as the paragraph of the definition list.

They are used by opening a definition list, then placing a definition title, which has an opening tag, the text of the title, and a closing tag, followed by the definition data which uses the same structure. Here is an example:

Code

<dl>
  <dt>Deprecated</dt>
  <dd>to express disapproval of</dd>
  <dt>Web Design</dt>
  <dd>The art of making something from nothing</dd>
</dl>

All three types of lists can contain an unlimited number of elements within them, so you only have to worry about breaking them up when it serves some other purpose, like going to a new topic.

Related Extra Credit

Since HTML knows what tags are which because they are marked with <>, what happens if you try to output one of these characters to the screen? The answer is, if you just type it from your keyboard, that the web page blows up.

Whenever you want to use a special character, you must use a special key code. These key codes start with an ampersand (&) and end with a semi-colon (;). If you stop and think for a second, you’d realize this makes the ampersand a special character as well.

There are also some special characters like the copyright symbol (©) which are more convenient to use their special codes for too, instead of having to copy them from the character map (and risk incompatibility).

Here is a table of some common special characters and their respective codes. You use them by simply placing the code where you want the character to be:

Symbol Character Code
& &amp;
> &gt;
< &lt;
© &copy;

Now that we can say something, we want to be able to make it look nice. In our next lesson, we’ll learn how to lay out our pages and even move into some basic CSS to make our pages look nice, starting with Lesson 3.1: Lay It Out! – Images.

This entry was posted on Tuesday, July 29th, 2008 at 11:30 am and is filed under HTML Lessons. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply

Please Login or Register or fill out the following to leave a reply:

If you haven't posted an approved comment before, your comment will not show up until approved.

  • HTML Blox Home
  • Blog
  • Design Blog
  • Flash Blog
  • General Blog
  • HTML Blog
  • Javascript Blog
  • PHP Blog
  • Programming Blog
  • Web Servers Blog
  • Forums
  • Where to Start?
  • Lessons
  • CSS Lessons
  • Design Lessons
  • HTML Lessons
  • Javascript Lessons
  • Programming Lessons
  • References
  • HTMLReferences
  • About
  • Resources
  • Contact
  • Go Green!
  • Sitemap

Copyright © 2008 HTML Blox

Unless otherwise noted, all images created and copyright HTML Blox.

Operated by Azure Ronin Web Design