Building HTML

HTML is a first-class way to present information to users. We're going to look at a little bit of HTML basics and then pound out some programs to present data. Some preliminary information:

Viewing HTML

Loading HTML


A Basic HTML File

Suppose these lines of text are in a file:
<HTML>
Hello MBL!
If you wrote that file correctly, it would look like this in a web browser.

Observe there are more complex things that can get stuck in tags:

<HTML>
<BODY bgcolor="#ffffff">
Hello MBL!
Looks like this in a web browser.

Bold

Suppose you'd like to see something in bold, Like this

That would be written as:

Suppose you'd like to see something in bold, <B>Like this</B>


Horizontal rule

Each of these sections is split by a horizontal rule, or <HR>

Line break

Suppose you wanted to force the text to
put a line break in the text.
Suppose you wanted to force the text to<BR>
put a line break in the text.

Unformatted text

Suppose      you    
      want spaces    and formatting
 in lots     of places.
<PRE>
Suppose      you    
      want spaces    and formatting
 in lots     of places.
</PRE>

Images.

To include pictures into html:

<img src="pic1.png">

Tables

Tables can be displayed as follows:
ItemPriceColor
Apple$0.03Red
Pear$0.05Yellow

<TABLE border = 1>
 <TR>
    <TH>Item</TH><TH>Price</TH><TH>Color</TH>
 </TR>
 <TR>
    <TD>Apple</TD><TD>$0.03</TD><TD>Red</TD>
 </TR>
 <TR>
    <TD>Pear</TD><TD>$0.05</TD><TD>Yellow</TD>
 </TR>
</TABLE>

Hot links

To hot link another page, like CNN.
To hot link another page, like <A HREF = "http://www.cnn.com">CNN</A>.

Most of these examples have been put into one more example file.
left right