1. WEBPROG1 – Web Programming 1 (HTML) Prelim Period
Handout #3
HTML Color Chart
Below is the hexadecimal representation for an array of HTML background colors. The
hexadecimal value that you see displayed in each box represents the value to get the background
color of that cell.
#000000 #000033 #000066 #000099 #0000CC #0000FF
#003300 #003333 #003366 #003399 #0033CC #0033FF
#006600 #006633 #006666 #006699 #0066CC #0066FF
#009900 #009933 #009966 #009999 #0099CC #0099FF
#00CC00 #00CC33 #00CC66 #00CC99 #00CCCC #00CCFF
#00FF00 #00FF33 #00FF66 #00FF99 #00FFCC #00FFFF
#330000 #330033 #330066 #330099 #3300CC #3300FF
#333300 #333333 #333366 #333399 #3333CC #3333FF
#336600 #336633 #336666 #336699 #3366CC #3366FF
#339900 #339933 #339966 #339999 #3399CC #3399FF
#33CC00 #33CC33 #33CC66 #33CC99 #33CCCC #33CCFF
#33FF00 #33FF33 #33FF66 #33FF99 #33FFCC #33FFFF
#660000 #660033 #660066 #660099 #6600CC #6600FF
#663300 #663333 #663366 #663399 #6633CC #6633FF
#666600 #666633 #666666 #666699 #6666CC #6666FF
#669900 #669933 #669966 #669999 #6699CC #6699FF
#66CC00 #66CC33 #66CC66 #66CC99 #66CCCC #66CCFF
#66FF00 #66FF33 #66FF66 #66FF99 #66FFCC #66FFFF
#990000 #990033 #990066 #990099 #9900CC #9900FF
#993300 #993333 #993366 #993399 #9933CC #9933FF
#996600 #996633 #996666 #996699 #9966CC #9966FF
#999900 #999933 #999966 #999999 #9999CC #9999FF
#99CC00 #99CC33 #99CC66 #99CC99 #99CCCC #99CCFF
#99FF00 #99FF33 #99FF66 #99FF99 #99FFCC #99FFFF
#CC0000 #CC0033 #CC0066 #CC0099 #CC00CC #CC00FF
#CC3300 #CC3333 #CC3366 #CC3399 #CC33CC #CC33FF
#CC6600 #CC6633 #CC6666 #CC6699 #CC66CC #CC66FF
#CC9900 #CC9933 #CC9966 #CC9999 #CC99CC #CC99FF
#CCCC00 #CCCC33 #CCCC66 #CCCC99 #CCCCCC #CCCCFF
#CCFF00 #CCFF33 #CCFF66 #CCFF99 #CCFFCC #CCFFFF
#FF0000 #FF0033 #FF0066 #FF0099 #FF00CC #FF00FF
#FF3300 #FF3333 #FF3366 #FF3399 #FF33CC #FF33FF
#FF6600 #FF6633 #FF6666 #FF6699 #FF66CC #FF66FF
Prepared By:RICHARD F. ORPIANO Page 1 of 6
2. WEBPROG1 – Web Programming 1 (HTML) Prelim Period
Handout #3
#FF9900 #FF9933 #FF9966 #FF9999 #FF99CC #FF99FF
#FFCC00 #FFCC33 #FFCC66 #FFCC99 #FFCCCC #FFCCFF
#FFFF00 #FFFF33 #FFFF66 #FFFF99 #FFFFCC #FFFFFF
HTML Links and Anchors
The web got its spidery name from the plentiful connections between web sites. These
connections are made using anchor tags to create links. Text, Images, and Forms may be used to
create these links.
Links can be Internal, Local, or Global.
• Internal - Links to anchors on the current page
• Local - Links to other pages within your domain
• Global - Links to other domains outside of your site
HTML Text Links
Use the <a></a> tags to define the start and ending of an anchor. The text you place between the
tags will be shown as the link on a page. Use the demonstration below as a reference.
Here's a list of target attributes for links. The target attribute defines whether to open the page in a
separate window, or to open the link in the current browser window.
target=" _blank" Opens new page in a new browser window
_self" Loads the new page in current window
_parent" Loads new page into a frame that is superior to where the link lies
_top" Loads new page into the current browser window, cancelling all frames
The example below shows how you would link to ESPN.COM, a popular sports web site. The
target attribute is added to allow the browser to open ESPN in a new window, so that the viewer can
remain at our web site. Here's the example.
Code:
<a href="http://www.ESPN.com" target="_blank">ESPN.COM</a>
Display:
ESPN.COM
HTML Image Links
Using graphics will liven up that tired bland looking text link. To make an image link simply insert
an image within the anchor tag. If you do not know how to use the image tag, skip ahead to the image
tutorial and come back after you feel comfortable with it.
Code:
<a href="http://www.espn.com" target="_blank>
<img src="ahman.gif">
</a>
Prepared By:RICHARD F. ORPIANO Page 2 of 6
3. WEBPROG1 – Web Programming 1 (HTML) Prelim Period
Handout #3
Display:
HTML Anchors
To link to sections of your existing page a name must be given to the anchor. In the example
below, we've created a mini Table of Contents for this page. By placing blank anchors just after each
heading, and naming them, we can then create reference links to those sections on this page as
shown below.
First, the headings of this page contain blank, named anchors. They look like this.
Tizag's Own Code:
<h1>HTML Links and Anchors<a name="top"></a></h1>
<h1>HTML Text Links<a name="text"></a></h1>
<h1>HTML Image Links<a name="imgs"></a></h1>
Now create the reference links, placing the pound symbol followed by the name of the anchor in
the href of the new link.
Code:
<a href="#top">Go to the Top</a>
<a href="#text">Learn about Text Links</a>
<a href="#imgs">Learn about Image Links</a>
Display:
Go to the Top
Learn about Text Links
Learn about Image Link
Email Links
Creating Email links are simple. If you want somebody to mail you about your site a good way to
do it is place an email link with a subject already inputted for them.
Code:
<a href="mailto:email@tizag.com?subject=Feedback">Email@tizag.com</a>
Display:
mailto:email@tizag.com?subject=Feedback
In some circumstances it may be necessary to fill in the body of the Email for the user as well.
Code:
<a href="mailto:email@tizag.com?subject=Feedback&body=I think your site
rocks!">Email@tizag.com</a>
Display:
mailto:email@tizag.com?subject=Feedback&body=I think your site rocks!
Prepared By:RICHARD F. ORPIANO Page 3 of 6
4. WEBPROG1 – Web Programming 1 (HTML) Prelim Period
Handout #3
Default Links - Base
head element to set a default URL for all links on a page to go to. It's always a good idea to set a base
tag just incase your links become bugged somewhere down the line. Usually set your base to your
home page.
Code:
<head>
<base href="http://www.tizag.com/">
</head>
HTML Images
Images are a staple of any web designer, so it is very important that you understand how to use
them properly. Use the <img> tag to place an image on your web page.
Code:
<img src="sunset.gif">
Display:
Above we have defined the src attribute. The src attribute tells the browser where the image is
located. You can use a local path name as we did above, or you may choose to display the complete
path (i.e. http://www.tizag.com/htmlT/sunset.gif).
Image Height and Width
To define the height and width of the image, rather than letting the browser compute the size, use
the height and width attributes.
Code:
<img src="sunset.gif" height="50" width="100">
Display:
Above we have defined the src, height and width attributes. By informing the browser of the image
dimensions it knows to set aside a place for that image. Without defining an image's dimensions your
Prepared By:RICHARD F. ORPIANO Page 4 of 6
5. WEBPROG1 – Web Programming 1 (HTML) Prelim Period
Handout #3
site may load poorly; text and other images will be moved around when the browser finally figures out
how big the picture is supposed to be and then makes room for the picture.
Vertically and Horizontally Align Images
Use the align and valign attributes to place images within your body, tables, or sections.
1. align (Horizontal)
o right
o left
o center
2. valign (Vertical)
o top
o bottom
o center
Below is an example of how to align an image to the right of a paragraph.
Code:
<p>This is paragraph 1, yes it is...</p>
<p>
<img src="sunset.gif" align="right">
The image will appear along the...isn't it?
</p>
<p>This is the third paragraph that appears...</p>
Display:
This is paragraph 1, yes it is. I think this paragraph serves as a nice example to show how this image
alignment works.
The image will appear along the right hand side of the paragraph. As you can
see this is very nice for adding a little eye candy that relates to the specified
paragraph. If we were talking about beautiful tropical sunsets, this picture
would be perfect. But we aren't talking about that, so it's rather a waste, isn't it?
This is the third paragraph that appears below the paragraph with the image!
Images as Links
This will be a quick review of the links - image lesson. Images are very useful for links and can be
created with the HTML below.
Code:
<a href="http://www.tizag.com/">
<img src="sunset.gif"> </a>
Display:
Prepared By:RICHARD F. ORPIANO Page 5 of 6
6. WEBPROG1 – Web Programming 1 (HTML) Prelim Period
Handout #3
Now your image will take you to our home page when you click it. Change it to your home page
URL.
Thumbnails
Thumbnails are small size (Kilobytes) pictures that link to the larger, high quality picture. To make
a thumbnail save a low-quality version of a picture and make it a smaller dimensions. Now make this
low-quality picture into an image link and have it point to the the high-quality picture.
Code:
<a href="sunset.gif"> <img src="thmb_sunset.gif"> </a>
Display:
HTML Gifs vs. Jpegs
Gifs are best used for banners, clip art, and buttons. The main reason for this is that gifs can have
a transparent background which is priceless when it comes to web design. On the down side, gifs are
usually larger files, not as compressed as a jpeg, which calls for slow load times and large transfer
rates. Gifs are also limited to the 256 color scheme.
Jpegs however, have an unlimited color wheel, and have a high compression rate downsizing
your load times and saving hard drive space. Jpegs don't allow for transparent backgrounds, but their
size/quality ratio is outstanding. Its best to use Jpegs for photo galleries, or artwork to allow the viewer
to catch that extra bit of detail. Avoid Jpegs for graphical design, stick to using them for thumbnails and
backgrounds
Prepared By:RICHARD F. ORPIANO Page 6 of 6