![]() |
HTML for Newcomers |
Home
Index
Introduction Lesson 1 |
Using this Lesson
If you've completed the Introduction you know how to use this Lesson. If not, remember:
, or any
term to see an
now)
ACTIVE.TXT now.
Remember, you can 
Plain Text into HTML
In , we'll mark up our plain text file (ACTIVE.TXT), turning it into . If you're unsure of what means, hover your mouse over
for a brief description.
Open the notes we made in Notepad
If you have Notepad's window open from the previous session, you can skip . Otherwise, remember that Notepad won't always be the editor registered to open TXT files, so we'll get some more practice with the method.
Glance through the preview below first, then click the button to go ahead :
or a term in purple text. All these InfoBox notes are built into the page, so they work online or offline.
We use a distinctive, bold purple cue where it's more appropriate. Either way, you'll know there are more details you can read whenever you want, simply by hovering your mouse over this device.
HTML=HyperText Markup Language is a system of tags to specify text layout. A tag looks like <b>M</b>, which says: put the letter M in bold. A <b> says start making what follows bold, and a </b> says stop. Tags usually come in start/stop pairs. It's how we put bold letters in "HyperText Markup Language". A browser (such as Internet Explorer or Mozilla) doesn't show the tags, it obeys them. An editor like Notepad merely shows the tags along with other text.
In some Windows versions (eg Windows Millennium), the Open With option is shown at the first Right-click, so you won't need to use the Shift +Right-click method that we explain in .Note Remember to use the Notepad window in its default size.
. Using Notepad in a restored window means you can see the CueWindow properly.
onClick is the term for the JavaScript event that occurs when you click the mouse cursor on an area of screen. JavaScript is an event-driven language. Its functions are often fired by events.
When several windows are open, only one has focus (it has a standard dark blue title bar). The window with focus is the one that receives any keystrokes from your keyboard. Where a window has keyboard input boxes, the box with focus is the one that typed characters will appear in. An easy way to shift focus is to click on a window (or its Taskbar button), or click in an input box. You can also use Alt Tab to put up a menu that will cycle the focus through all windows.
The box
With the file open in Notepad, we'll make a note about the box. As we learnt in the Introduction, this supplies instant help ing any technical term.
Use the scroll bars in the to see all of a large preview – remember to return to the Notepad window so you can type into it :
Text into HTML
Since an file is a plain text file with an .HTM or .HTML extension, the next step is to save our plain text notes as active.htm :
Note file names are often in lowercase, because this is common in , where file names are case-sensitive.
View your file as HTML
To understand tags properly, it helps to see their effect at each step. The below will help you open your file in a browser window scaled to fit the Lesson's screen layout.
Click in the box, enter filename – or browse
Enter full path, or click Browse and locate your file:
Either enter the to the active.htm file in the box; Or use the Browse button to find it; then click on it; then click the Open button (you can use the Files of type pull-down box to look only for *.htm,*.html files to make it easier to locate).
Your notes as HTML
With the path to your file in the box, click the View as HTML button. A new window opens, placed so you can compare your progress at each Step with a .
Some work remains!
When a browser renders your initial active.htm it's displayed with:
Art is long, life is short
Marking up text is an art. But, sometimes, all you want is a legible result, fast. So, first, let's learn one quick kludge – the tag :
You must save changes
You did remember to click File, Save to save that change to active.htm, didn't you?
The tag
Let's stop calling the new window: "new window", and give it a title that appears on its Taskbar button. This is done with the tag :
When you've saved the change, click the Taskbar button for the new window, and press F5 to refresh it. Its Taskbar button (and Title bar) will show the name HTML view , which makes it easier to distinguish amidst the other buttons on your Taskbar.
Remember to get help
Use the help built into this page (it's there whether you stay online or
, or any
term to see an
for details and cross-referencesCorrect spelling is vital when using tags
You must spell tag names correctly. Browsers don't spellcheck. They ignore tags they don't recognise. If you spell a tag wrongly, say <tilte> for , or forget the
The Lesson plan:
Marking up properly
That was the quick fix ... now to do it properly. We'll split the job into four stages, and learn a useful range of mark up techniques on the way. The is the main outline plan:
There's a Step button to check the HTML view of your document after every tiny change. By working in small steps, and checking each one, you learn more easily.
Back to square one
We need to take out the tags again. Their correct use is for short extracts of text where an exact format is needed, such as Computer Program Code examples.
With the tags out, we'll be able see the effect of other tags properly :
The structural tags:
Browsers can infer the document structure
It's conventional to use structural tags to divide the whole document explicitly into two sections. Most browsers can deduce the structure (at least in simple cases), and these tags won't make any difference to the way we see our current document in HTML view :
The tag
First, and tags are placed around the entire document :
The and tags
A document is usually laid out in two principal, explicit sections:
Uppercase/lowercase?
By the way, it doesn't matter whether you use uppercase or lowercase for tag names. But do stick to one convention or the other. If you mix cases, you may find Browsers won't render your documents properly, as newer and tighter standards are introduced.
Basic layout:
Centring, paragraphing, and line control
As we'll see in Lesson 2, there is often an tag and an alternative Style Rule that achieves the same effect. That's because Style Rules are designed to supersede older ways of doing things (especially for fine details of layout).
But remains a simpler way to handle basic layout, and that's what we'll start with:
The tag
This does what it says, (but you must spell it US-style=center). We can use it to centre the heading of the notes :
The (paragraph) tag
We'll put the first definition in a paragraph, with the tag. This simple tag is very useful for basic text layout. As usual, there's a corresponding close tag: .
Add the paragraph tags around the definition :
The (line break) tag
The line break tag is unusual: it doesn't have a closing form. It's an instruction to the Browser to start a new line. It's like pressing Return when you're typing a text file.
Browsers wrap your text automatically
A Browser doesn't treat a Return as a cue to start a new line. One or more Return s (like multiple Space s) are rendered as a single Space . The resulting text is wrapped automatically to fit the Browser window. The Browser chooses a convenient point to wrap a line, such as between words, or at a – (dash or hyphen).
Use a line break tag to start a new line :
Definition lists:
Tags intended for terms and their definitions
We've marked up and its definition with paragraph and line break tags. These are useful tags to know, but for the other definitions we'll try something different.
has several handy groups of tags to format lists. There's a special group meant for lists of terms and their associated definitions:
A definition list uses three (related) tags
We'll practise on and its definition first (and extend the tagging to other terms afterwards). There are three two-letter tags. Each starts with a letter d for Definition. The second letter is either l, t, or d (l=List, t=Term, d=its Definition). They work like this:
Note You're free to insert blank lines and white space (= Space or Tab characters). The browser ignores them, but they make the document easier for you to read.
Extending the list to include Lookup box
Let's extend the Definition List tagging to include the term LookUp box and its definition, too. We can do it like this:
Extending the list to include What is active text?
In the same way, we can extend the Definition List tagging back, so that it includes the question and its answer.
This time we leave the (close) tag in place, but move the (open) tag. We also need to take out the paragraph and line-break tags and replace them with the Definition List tags for a term and its definition :
Extending the list to include CueWindow
Now extend the Definition List tagging to include the final term, . We can also improve its definition with a new type of list (but we'll defer that until Stage 4).
For now, tag , and its entire definition, as we did for the other terms. Don't forget to move the (close) tag, too :
Other list styles:
Ordered and Unordered
There are two other list styles for which provides dedicated tags:
Ordered Lists:
Each item is numbered automatically
In our definition, we have two Styles: Edit and MultiStep. We can make them stand out better by tagging them as a list. Lists can be nested, so we can create this new list inside the main Definition List.
We'll use and tags for the two Styles, to create an Ordered List. The preview has the tags colour-coded to show how they match up :
Adding extra text to the list items
With the items tagged as a list, we can add further text to each of them. For example, we can include a gloss (explanation) for each. Try it for yourself :
Adding an extra item
If we add more items, the browser will number them for us. For example, there's another style of , which is used in our Batch File Course.
It simulates a DOS window, and it looks like this :
Add DOS style to the existing list
Add the new style, DOS and its description. Make it first in the list and the browser will automatically re-number the other two items :
Unordered lists:
List items are displayed as bullet points
For items that you want to display as a series of bullet points, rather than a numbered sequence, you can use the and tags to create an Unordered List.
Indeed, the three styles would be more effectively presented in this way.
So let's change our Ordered List to an Unordered one :
Adding white space:
Using the tag to add blank lines
We can improve the look of the Definition List with a blank line between each pair of Term+Definition. Put a tag in front of each Term except the first :
Non-breaking Spaces:
Adding white space and controlling line wrap
We've seen that multiple Space s are ignored by the Browser. We've also seen that the Browser will wrap lines at any boundary between words.
Sometimes you need to insert several consecutive Space s, or avoid a line break ever coming between two adjacent words. For this, you can use a Non-breaking Space.
This is one of a number of special s inserted with the
The Browser will render each
Controlling line wrap
A Browser will wrap lines at any convenient Space or hyphen (and at a few other points). It's a matter of chance (depending on window size and screen resolution). But you can use non-breaking spaces to control line wrap, in a subtle way.
For example, suppose you're writing the History of a War. See how a strong, clear sentence can become a weak, confused one with an unlucky line wrap.
If you write: It was not. your sentence will never wrap between was not ... On that nice point of rhetoric, we'll close this Lesson.
pull-down box
You can refresh your memory for any point you're unsure about with this pull-down version of the Course Reference. It has s for all the terms we've met so far.
The Lesson summary
Remember the cycle: Preview
Do
Review. It's time to Review what we've learnt:
The next Lesson
The Index has the syllabus for the next Lesson, where we'll add style to our document with Cascading Style Sheet rules. See you then.