Professional Web Design Essential
Professional Web Design Essential
Internet
World Wide computer network that allows communication and data transfer between people connected to Computers.
Network
Network is a group of interconnected computer that share resources and information.
What is the difference between the World Wide Web and the Internet?
The World Wide Web (The Web) is only a portion of what makes up the internet, but it is the fastest growing part of the
internet. The Web lets people, organizations and companies publish information for other people to see. This makes the Web
a very useful tool for finding information on just about any topic.
The Web is a large number of computer documents or "Web pages" that are stored on computers around the world and are
connected to one another using hyperlinks. These Web pages can be seen by anyone through their computer's "Web
Browser," which is the program you are using now.
A group of Web pages that follow the same theme and are connected together with hyperlinks is called a "Web site." Web
sites and Web pages are written in a coding language that makes it possible to add pictures, sound and interactivity to plain old
text, making people's reading experience more exciting.
Page – 1
DATA WORLD Computer Training Professional Web Design Course
http://
This part of the address indicates that it is a Web page. www. This indicates that the Web page you are looking at is part of the
World Wide Web. Many Web sites do not use www but are still part of the Web. google.com This part of the address is the
domain name and indicates the unique address of a Web site. The domain name also often indicates what the site is about, for
example www.Flower.com is a Web site about flowers.
/Services/
The "/" symbol indicates you have moved into a specific directory in the Web sites. Directories are like the folders on your
computer and help to organize Web pages in a Web sites. index.htm A word with ".htm" or "html" following it indicates the
name of the specific page in the Web site you are looking at.
Web browsers
Web browsers are programs used to explore the Internet. There are many Web browser programs available including
Netscape Navigator, Internet Explorer and Opera.
Introduction to HTML
Page – 2
DATA WORLD Computer Training Professional Web Design Course
HTML Elements
HTML documents are text files made up of HTML elements.
HTML elements are defined using HTML tags.
Page – 3
DATA WORLD Computer Training Professional Web Design Course
HTML Tags
Page – 4
DATA WORLD Computer Training Professional Web Design Course
Headings
Headings are defined with the <h1> to <h6> tags. <h1> defines the largest heading. <h6> defines the smallest heading.
<h1>This is a heading</h1>
<h2>This is a heading</h2>
<h3>This is a heading</h3>
<h4>This is a heading</h4>
<h5>This is a heading</h5>
<h6>This is a heading</h6>
HTML automatically adds an extra blank line before and after a heading.
Paragraphs
Paragraphs are defined with the <p> tag.
<p>This is a paragraph</p>
<p>This is another paragraph</p>
HTML automatically adds an extra blank line before and after a paragraph.
Line Breaks
The <br> tag is used when you want to break a line, but don't want to start a new paragraph. The <br> tag forces a line
break wherever you place it.
<p>This <br> is a para<br>graph with line breaks</p>
The <br> tag is an empty tag. It has no end tag like </br>, since a closing tag doesn't make any sense.
<br> or <br />
Comments in HTML
The comment tag is used to insert a comment in the HTML source code. A comment will be ignored by the browser. You
can use comments to explain your code, which can help you when you edit the source code at a later date.
<!-- This is a comment -->
Note that you need an exclamation point after the opening bracket, but not before the closing bracket.
HTML Attributes
Attributes provide additional information to an HTML element.
Attributes Example 1:
<h1> defines the start of a heading.
<h1 align="center"> has additional information about the align.
Page – 5
DATA WORLD Computer Training Professional Web Design Course
Attributes Example 2:
<body> defines the body of an HTML document.
<body bgcolor="yellow"> has additional information about the background color.
Attributes Example 3:
<table> defines an HTML table. (You will learn more about HTML tables later)
<table border="1"> has additional information about the border around the table.
Page – 6
DATA WORLD Computer Training Professional Web Design Course
HTML Backgrounds
A good background can make a Web site look really great.
Backgrounds
The <body> tag has two attributes where you can specify backgrounds. The background can be a color or an image.
Page – 7
DATA WORLD Computer Training Professional Web Design Course
Bgcolor
The bgcolor attribute specifies a background-color for an HTML page. The value of this attribute can be a hexadecimal
number, an RGB value, or a color name:
<body bgcolor="#000000">
<body bgcolor="rgb(0,0,0)">
<body bgcolor="black">
The lines above all set the background-color to black.
HTML Colors
Colors are displayed combining RED, GREEN, and BLUE light sources.
The table below shows the result of combining Red, Green, and Blue light sources:.
Color Color HEX Color RGB
Black #000000 rgb(0,0,0)
Red #FF0000 rgb(255,0,0)
Green #00FF00 rgb(0,255,0)
Blue #0000FF rgb(0,0,255)
Yellow #FFFF00 rgb(255,255,0)
Cyan #00FFFF rgb(0,255,255)
Silver #C0C0C0 rgb(192,192,192)
White #FFFFFF rgb(255,255,255)
Background
The background attribute specifies a background-image for an HTML page. The value of this attribute is the URL of the
image you want to use.
<body background="clouds.gif">
<body background="http://www.google.com/clouds.gif">
HTML Images
With HTML you can display images in a document.
The Image Tag and the Src Attribute
In HTML, images are defined with the <img> tag.
The <img> tag is empty, which means that it contains attributes only and it has no closing tag.
To display an image on a page, you need to use the src attribute. Src stands for "source". The value of the src attribute is the
URL of the image you want to display on your page. The syntax of defining an image:
<img src="url">
Page – 8
DATA WORLD Computer Training Professional Web Design Course
The "alt" attribute tells the reader what he or she is missing on a page if the browser can't load images. The browser will
then display the alternate text instead of the image. It is a good practice to include the "alt" attribute for each image on a
page, to improve the display and usefulness of your document for people who have text-only browsers.
Syntax:
<img src=”url”>
Where src=”url” specifies the location of the graphic
Attributes:
Align=”value” The align attribute allows you to tell the browser how you want the image
to be alignment options are available.
Bottom Align the image at the bottom of the current line position.
Middle Centers the image in the middle of the current line position
Top Align the image at the top of the current line position
Alt An alternate text message that non-image supporting browsers will display in the place
Height The heigh of the image in pixels or as a percentage of the actual object size
Width The width of the image in pixels or as a percentage of the actual object size
Border The thickness in pixels of the border to be placed around the image. A value of 0 mean
This example demonstrates how you can control the text formatting.
<html>
<body>
<b>This text is bold</b><br><strong>This text is strong</strong><br><big>This text is big</big><br>
<em>This text is emphasized</em><br><i>This text is italic</i><br><small>This text is small</small> <br>This text
contains<sub>subscript</sub><br>This text contains<sup>superscript</sup></body>
</html>
Page – 9
DATA WORLD Computer Training Professional Web Design Course
This example demonstrates how you can control the line breaks and spaces with the pre tag.
<html>
<body>
<pre>
This is
preformatted text.
It preserves both spaces
and line breaks.
</pre>
<p>The pre tag is good for displaying computer code:</p>
<pre>
for i = 1 to 10
print i
next i
</pre>
</body>
</html>
Page – 10
DATA WORLD Computer Training Professional Web Design Course
This example demonstrates how to mark a text that is deleted or inserted to a document.
<html>
<body>
<p> a dozen is <del>twenty</del> <ins>twelve</ins> pieces </p>
</body>
</html>
HTML Lists
HTML supports ordered, unordered and definition lists.
Unordered Lists
An unordered list is a list of items. The list items are marked with bullets (typically small black circles).
An unordered list starts with the <ul> tag. Each list item starts with the <li> tag.
<ul>
<li>Coffee</li>
<li>Milk</li>
</ul>
Here is how it looks in a browser:
Coffee
Milk
Inside a list item you can put paragraphs, line breaks, images, links, other lists, etc.
Ordered Lists
An ordered list is also a list of items. The list items are marked with numbers.
An ordered list starts with the <ol> tag. Each list item starts with the <li> tag.
<ol>
<li>Coffee</li>
<li>Milk</li>
</ol>
Here is how it looks in a browser:
1. Coffee
2. Milk
Inside a list item you can put paragraphs, line breaks, images, links, other lists, etc.
Definition Lists
A definition list is not a list of items. This is a list of terms and explanation of the terms.
A definition list starts with the <dl> tag. Each definition-list term starts with the <dt> tag. Each definition-list definition
starts with the <dd> tag.
Page – 11
DATA WORLD Computer Training Professional Web Design Course
<dl>
<dt>Coffee</dt>
<dd>Black hot drink</dd>
<dt>Milk</dt>
<dd>White cold drink</dd>
</dl>
Here is how it looks in a browser:
Coffee
Black hot drink
Milk
White cold drink
Inside a definition-list definition (the <dd> tag) you can put paragraphs, line breaks, images, links, other lists, etc.
HTML Links
HTML uses a hyperlink to link to another document on the Web.
The Anchor Tag and the Href Attribute
HTML uses the <a> (anchor) tag to create a link to another document.
An anchor can point to any resource on the Web: an HTML page, an image, a sound file, a movie, etc.
The syntax of creating an anchor:
<a href="url">Text to be displayed</a>
The <a> tag is used to create an anchor to link from, the href attribute is used to address the document to link to, and the
words between the open and close of the anchor tag will be displayed as a hyperlink.
This anchor defines a link to Google:
<a href="http://www.google.com/">Visit Google!</a>
Page – 12
DATA WORLD Computer Training Professional Web Design Course
This example demonstrates how to link to another page by opening a new window, so that the visitor does not have to
leave your Web site.
<html>
<body>
<a href="lastpage.htm" target="_blank">Last Page</a>
<p> If you set the target attribute of a link to "_blank",the link will open in a new window. </p>
</body>
</html>
This example demonstrates how to use a link to jump to another part of a document.
<html>
<body>
<p>
<a href="#C4">See also Chapter 4.</a>
</p>
<h2>Chapter 1</h2> <p>This chapter explains ba bla bla</p>
<h2>Chapter 2</h2> <p>This chapter explains ba bla bla</p>
<h2>Chapter 3</h2> <p>This chapter explains ba bla bla</p>
<h2><a name="C4">Chapter 4</a> </h2> <p>This chapter explains ba bla bla</p>
<h2>Chapter 5</h2> <p>This chapter explains ba bla bla</p>
<h2>Chapter 6</h2> <p>This chapter explains ba bla bla</p>
<h2>Chapter 7</h2> <p>This chapter explains ba bla bla</p>
<h2>Chapter 8</h2> <p>This chapter explains ba bla bla</p>
<h2>Chapter 9</h2> <p>This chapter explains ba bla bla</p>
<h2>Chapter 10</h2> <p>This chapter explains ba bla bla</p>
<h2>Chapter 11</h2> <p>This chapter explains ba bla bla</p>
<h2>Chapter 12</h2> <p>This chapter explains ba bla bla</p>
<h2>Chapter 13</h2> <p>This chapter explains ba bla bla</p>
<h2>Chapter 14</h2> <p>This chapter explains ba bla bla</p>
<h2>Chapter 15</h2> <p>This chapter explains ba bla bla</p>
</body>
</html>
Page – 13
DATA WORLD Computer Training Professional Web Design Course
HTML Frames
With frames, you can display more than one Web page in the same browser window.
Page – 14
DATA WORLD Computer Training Professional Web Design Course
Frames
With frames, you can display more than one HTML document in the same browser window. Each HTML document is
called a frame, and each frame is independent of the others.
The disadvantages of using frames are:
The web developer must keep track of more HTML documents
It is difficult to print the entire page
This example demonstrates how to make a horizontal frameset with three different documents.
<html>
<frameset rows="25%,50%,25%">
<frame src="mypage1.html">
<frame src="mypage2.html">
<frame src="mypage3.html">
</frameset>
</html>
This example demonstrates how to make a frameset with three documents, and how to mix them in rows and
columns.
<html>
<frameset rows="50%,50%">
<frame src="mypage1.html">
<frameset cols="25%,75%">
<frame src="mypage2.html">
<frame src="mypage3.html">
</frameset>
</frameset>
Page – 15
DATA WORLD Computer Training Professional Web Design Course
</html>
This example demonstrates the noresize attribute. The frames are not resizable. Move the mouse over the borders
between the frames and notice that you can not move the borders.
<html>
<frameset rows="50%,50%">
<frame noresize="noresize" src="mypage1.html">
<frameset cols="25%,75%">
<frame noresize="noresize" src="mypage2.html">
<frame noresize="noresize" src="mypage3.html">
</frameset>
</frameset>
</html>
HTML Tables
Tables Tables are defined with the <table> tag. A table is divided into rows (with the <tr> tag), and each row is divided into
data cells (with the <td> tag). The letters td stands for "table data," which is the content of a data cell. A data cell can
contain text, images, lists, paragraphs, forms, horizontal rules, tables, etc.
<table border="1">
<tr>
<td>row 1, cell 1</td>
<td>row 1, cell 2</td>
</tr>
<tr>
<td>row 2, cell 1</td>
<td>row 2, cell 2</td>
</tr>
</table>
How it looks in a browser:
row 1, cell 1 row 1, cell 2
row 2, cell 1 row 2, cell 2
Page – 16
DATA WORLD Computer Training Professional Web Design Course
Headings in a Table
Headings in a table are defined with the <th> tag.
<table border="1">
<tr>
<th>Heading</th>
<th>Another Heading</th>
</tr>
<tr>
<td>row 1, cell 1</td>
<td>row 1, cell 2</td>
</tr>
<tr>
<td>row 2, cell 1</td>
<td>row 2, cell 2</td>
</tr>
</table>
How it looks in a browser:
Heading Another Heading
row 1, cell 1 row 1, cell 2
row 2, cell 1 row 2, cell 2
Page – 17
DATA WORLD Computer Training Professional Web Design Course
row 2, cell 1
Note that the borders around the empty table cell are missing (NB! Mozilla Firefox displays the border).
To avoid this, add a non-breaking space ( ) to empty data cells, to make the borders visible:
<table border="1">
<tr>
<td>row 1, cell 1</td>
<td>row 1, cell 2</td>
</tr>
<tr>
<td>row 2, cell 1</td>
<td> </td>
</tr>
</table>
How it looks in a browser:
row 1, cell 1 row 1, cell 2
row 2, cell 1
</table>
</body>
</html>
This example demonstrates how to define table cells that span more than one row or one column.
<html>
<body>
<h4>Cell that spans two columns:</h4>
<table border="1">
This example demonstrates how to use cellpadding to create more white space between the cell content and its
borders.
<html>
<body>
<h4>Without cellpadding:</h4>
<table border="1">
<tr> <td>First</td> <td>Row</td> </tr>
<tr> <td>Second</td> <td>Row</td> </tr>
</table>
<h4>With cellpadding:</h4>
<table border="1" cellpadding="10">
<tr> <td>First</td> <td>Row</td> </tr>
<tr> <td>Second</td> <td>Row</td> </tr>
</table>
</body>
</html>
Page – 19
DATA WORLD Computer Training Professional Web Design Course
</body>
</html>
This example demonstrates how to add a background to one or more table cells.
<body>
<h4>Cell backgrounds:</h4>
<table border="1">
<tr> <td bgcolor="red">First</td> <td>Row</td> </tr>
<tr> <td background="bgdesert.jpg">Second</td> <td>Row</td> </tr>
</table>
</body>
</html>
This example demonstrates how to use the "align" attribute to align the content of cells, to create a "nice-looking"
table
<html>
<body>
<table width="400" border="1">
<tr> <th align="left">Money spent on....</th> <th align="right">January</th> <th align="right"> February </th>
</tr>
<tr> <td align="left">Clothes</td> <td align="right">$241.10</td> <td align="right">$50.20</td> </tr>
<tr> <td align="left">Make-Up</td> <td align="right">$30.00</td> <td align="right">$44.45</td> </tr>
<tr> <td align="left">Food</td> <td align="right">$730.40</td> <td align="right">$650.00</td> </tr>
<tr> <th align="left">Sum</th> <th align="right">$1001.50</th> <th align="right">$744.65</th> </tr>
</table>
</body>
</html>
HTML Forms
Form Controls
A Form is made up of fields or control, as well as the markup form and control its presentation. Form controls include text
fields, password fields, multiple-line text fields. Pop-up menus. Scrolled lists, radio buttons, check boxes and button, hidden
from controls are also possible. The most common element used to specify a form control the <input> element. However,
<select>, in conjuction with the <option> element and the <textarea> elements is also common forms.
Text Controls
Text controls are form fileds, generally one line long, that take input like a person’s name. There field specified with the
<input> element, but it is possible to specify a multiple-line text field using the <textarea> element.
Syntax:
<input type=”text” name=”cusname” size=”30” maxlength=”25” value=”Mg Mg”>
<textarea rows=”5” cols=”60” name=”comment”> Text ….. </textarea>
Password Fields
The password style of form control is the same as the simple text entry field, except that the input to the field is not revealed.
In many cases, the browser may render each character as an asterisk or do not avoid people seeing the password being
entered.
Syntax:
<input type=”password” name=”pin” size=”20” maxlength=”16”>
Page – 20
DATA WORLD Computer Training Professional Web Design Course
Page – 21
DATA WORLD Computer Training Professional Web Design Course
To add a favicon icon to a webpage in HTML you must use the <link> element,
<head>
<title>BricksofWeb - Train of codes</title>
<link rel="icon" type="image/ico" href="favicon.ico">
</head>
If you are using XHTML doctype then you must end the code with a /, as below
<head>
<title>BricksofWeb - Train of codes</title>
<link rel="icon" type="image/ico" href="favicon.ico" />
</head>
Let us briefly look what are rel, type and href attributes in a <link> element.
A rel attribute tells the <link> element, that a favicon icon is gonna be added to a webpage by the value icon.
The type attribute denotes the media type which is gonna be added here. If the media type is .png, .gif or .ico you must use,
image/png, image/gif and image/ico values respectively to the type attribute.
And at last the href attribute tells the address(URL) of the image stored in a web server.
Meta Element
< meta name="Title" content="Page Title Here">
< meta name ="keywords" content ="webdesign,tutorials,learning,computer">
< meta name ="copyright" content ="Copyright 2013">
< meta name ="description" content ="Web Design Specialist,Matthew Osbrne is 14yr Developer">
Page – 22
DATA WORLD Computer Training Professional Web Design Course
<tr bgcolor="#FFFF00">
<td colspan="2">
<center>
<a href="home.htm">Home</a> |<a href="products.htm">Products</a> |<a href="services.htm"> Services </a> |<a
href="about.htm">About Us</a> |<a href="about.htm">About Us</a> |<a href="contact.htm"> Contact </a> </td>
</center>
</tr>
<tr valign="top" align="center">
<td style="background-color:#FFD700;width:50px;">
<br /> <a href="home.htm">Home</a> <br /> <a href="products.htm">Products</a> <br /> <a href= "services.htm">
Services</a> <br /> <a href="about.htm">About Us</a><br /><a href="contact.htm"> Contact </a> <br /> </td>
<td style="background-color:#eeeeee;height:500px;width:600px;text-align:top;">Content goes here </td>
</tr>
<tr>
<td colspan="2" style="background-color:#FFA500; text-align:center;">Copyright © mmdataprovider.com</td>
</tr>
</table>
</center>
</body>
</html>
Page – 23
DATA WORLD Computer Training Professional Web Design Course
What is CSS?
∙ CSS stands for Cascading Style Sheets
∙ Styles define how to display HTML elements
∙ Styles were added to HTML to solve a problem
∙ External Style Sheets can save a lot of work
∙ External Style Sheets are stored in CSS files
CSS Syntax
The CSS syntax is made up of three parts: a selector, a property and a value.
The selector is normally the HTML element/tag you wish to define, the property is the attribute you wish to change, and each
property can take a value. The property and value are separated by a colon and surrounded by curly braces.
Example:
p {font-family: "arial"}
Grouping
You can group selectors. Separate each selector with a comma.
Example: p, input {font-size:12pt}
CSS Example
A CSS declaration always ends with a semicolon, and declaration groups are surrounded by curly brackets:
p{
color:red;text-align:center;
}
CSS Comments
A CSS comment begins with /* and ends with */" like this:
on several elements.
This allows you to set a particular style for many HTML elements with the same class.
The class selector uses the HTML class attribute, and is defined with a "."
.center {
text-align:center;
}
You can also specify that only specific HTML elements should be affected by a class.
In the example below, all p elements with class="center" will be center-aligned:
p.center {
text-align:center;
}
Do NOT start a class name with a number! This is only supported in Internet Explorer.
Class Selector
With the class selector you can define different styles for the same type of HTML element.
Example:
.text {color:'green'; font-size:'10pt'; font-face:'courier new'}
.button { color:blue; width:100px}
Input.text {color:'green'; font-size:'10pt'; font-face:'courier new'}
Input.button { color:blue; width:100px}
center left
center center
center right
bottom left
bottom center
bottom right
x% y%
x pos y pos
Background A shorthand property for setting all background background-color
properties in one declaration background-image
background-repeat
background-attachment
background-position
Background Color
The background-color property specifies the background color of an element.The background color of a page is defined in the
body selector:
body {background-color:#b0c4de;}
h1, p, and div elements have different background colors.
Background Image
The background-image property specifies an image to use as the background of an element.
By default, the image is repeated so it covers the entire element.
The background image for a page can be set like this:
body {background-image:url('paper.gif');}
background-position:right top;
}
<html>
<head>
<style type="text/css">
body{
background-color: #6495ed;
background-image:url('img_tree.png');
background-repeat:no-repeat;
background-position:right top;
}
body{
background:#6495ed url('img_tree.png') no-repeat right top;
}
</style>
</head>
<body>
<p>Background no-repeat, set postion example.</p>
<p>Now the background image is only shown once, and positioned away from the text.</p>
</body>
</html>
<html>
<head>
<style type="text/css">
body {
background-image:url('smiley.gif');
background-repeat:no-repeat;
background-attachment:fixed;
}
</style>
</head>
<body>
<p>The background-image is fixed. Try to scroll down the page.</p>
<p>The background-image is fixed. Try to scroll down the page.</p>
<p>The background-image is fixed. Try to scroll down the page.</p>
<p>The background-image is fixed. Try to scroll down the page.</p>
<p>The background-image is fixed. Try to scroll down the page.</p>
……copy & pase for many paragraphs……..
</body>
</html>
Page – 29
DATA WORLD Computer Training Professional Web Design Course
</style>
</head>
<body>
<h1>CSS text-align Example</h1>
<p class="date">May, 2009</p>
<p class="main">In my younger and more vulnerable years my father gave me some advice that I've been turning over in my
mind ever since. 'Whenever you feel like criticizing anyone,' he told me,
'just remember that all the people in this world haven't had the advantages that you've had.'</p>
<p><b>Note:</b> Resize the browser window to see how the value "justify" works.</p>
</body>
</html>
<html><!—text-decoration -- >
<head>
<style type="text/css">
a {text-decoration:none;}
h1 {text-decoration:overline;}
h2 {text-decoration:line-through;}
h3 {text-decoration:underline;}
h4 {text-decoration:blink;}
</style>
</head>
<body>
<p>Link to: <a href="http://www.google.com">google.com</a></p>
<h1>This is heading 1</h1>
<h2>This is heading 2</h2>
<h3>This is heading 3</h3>
<h4>This is heading 4</h4>
<p><b>Note:</b> The "blink" value is not supported in IE, Chrome, or Safari.</p>
</body>
</html>
<html><!—text-indentation -- >
<head>
<style type="text/css">
p {text-indent:100px;}
</style>
</head>
<body>
<p>In my younger and more vulnerable years my father gave me some advice that I've been turning over in my mind ever since.
'Whenever you feel like criticizing anyone,' he told me, 'just remember that all the people in this world haven't had the advantages
that you've had.'</p>
</body>
</html>
<html><!—text-transform -- >
<head>
<style type="text/css">
p.uppercase {text-transform:uppercase;}
Page – 31
DATA WORLD Computer Training Professional Web Design Course
p.lowercase {text-transform:lowercase;}
p.capitalize {text-transform:capitalize;}
</style>
</head>
<body>
<p class="uppercase">This is some text.</p>
<p class="lowercase">This is some text.</p>
<p class="capitalize">This is some text.</p>
</body>
</html>
caption
icon
menu
message-box
small-caption
status-bar
Page – 34
DATA WORLD Computer Training Professional Web Design Course
border-color Sets the color of the four borders, can have from one color
to four colors
border-right A shorthand property for setting all of the properties border-right-width
for the right border in one declaration border-style
border-color
border-right-color Sets the color of the right border border-color
border-right-style Sets the style of the right border border-style
border-right-width Sets the width of the right border thin
medium
thick
length
border-style Sets the style of the four borders, can have from one None,hidden,dotted,
to four styles dashed,solid,double,
groove,ridge,inset
outset
border-width A shorthand property for setting the width of the thin, medium, thick, length
four borders in one declaration, can have from one to
four values
Border A shorthand property for setting all of the properties border-width
for the four borders in one declaration border-style
border-color
Page – 35
DATA WORLD Computer Training Professional Web Design Course
Margin - Clears an area around the border. The margin does not have a background color, it is completely
transparent
Border - A border that goes around the padding and content. The border is affected by the background color of the
box
Padding - Clears an area around the content. The padding is affected by the background color of the box
Content - The content of the box, where text and images appear.
To calculate the full size of an element, you must also add the padding, borders and margins.
The total width of the element in the example below is 300px:
width:250px;
padding:10px;
border:5px solid gray;
margin:10px;
Let's do the math:
250px (width)
+ 20px (left and right padding)
+ 10px (left and right border)
+ 20px (left and right margin)
= 300px
The total width of an element should be calculated like this:
Total element width = width + left padding + right padding + left border + right border + left margin + right margin.
Measurement Values
Unit Description
% percentage
in inch
cm centimeter
mm millimeter
em 1em is equal to the current font size. 2em means 2 times the size of the current font.
ex one ex is the x-height of a font (x-height is usually about half the font-size)
pt point (1 pt is the same as 1/72 inch)
pc pica (1 pc is the same as 12 points)
Page – 36
DATA WORLD Computer Training Professional Web Design Course
border-style:dotted solid;
o top and bottom borders are dotted
o right and left borders are solid
border-style:dotted;
o all four borders are dotted
border:5px solid red;
Page – 38
DATA WORLD Computer Training Professional Web Design Course
Relative positioning
Relative positioning is setting the position of the element relative to its own position. If we change the position of Div B to a
relative position like this:
1 #B {
2 position: relative;
3 left: 150px; top: 120px;}
This would result in a rendering on screen like this:
Div B has changed position 150px to the right and 120px downwards relative to its original position.
The use of relative positioning becomes more important when combined with absolute positioning.
Absolute positioning
Absolute positioning means setting the position of an element relative to its container or parent element. In the case of our
Div’s A, B and C the container is the body. So let’s see what the position of Div B becomes if we change our code to:
1 #B {
2 position: absolute;
3 left: 150px; top: 120px;}
We see below that Div B is now positioned 150px to the right of the left body edge and 120px downwards from the top
body edge.
Page – 39
DATA WORLD Computer Training Professional Web Design Course
Fixed positioning
Fixed positioning differs from the other three. With fixed positioning the element is positioned relative to the browser
window. We have now added div D with a fixed position:
1 #D {
2 position: fixed;
3 bottom: 0px;}
Bottom Property
img
{
position:absolute;
bottom:5px;
}
Clip Property
div#myBox
{
position:absolute;
background-color:yellow;
width:100px;
clip:rect(10px,50px,50px,10px);
}
OverFlow Property
The overflow property specifies what to do if the content of an element exceeds the size of the element's box.
<html>
<head>
<style>
Page – 40
DATA WORLD Computer Training Professional Web Design Course
div.scroll{
background-color:#00FFFF;
width:100px;
height:100px;
overflow:scroll;
}
div.hidden {
background-color:#00FF00;
width:100px;
height:100px;
overflow:hidden;
}
</style>
</head>
<body>
<p>overflow:scroll</p>
<div class="scroll">You can use the overflow property when you want to have better control of the layout. The default value
is visible.</div>
<p>overflow:hidden</p>
<div class="hidden">You can use the overflow property when you want to have better control of the layout. The default value
is visible.</div>
</body>
</html>
% Raises or lower an element in a percent of the "line-height" property. Negative values are allowed
ZIndex Property
The zIndex property sets or returns the stack order of a positioned element.
<html>
<head>
<style>
img{
position:absolute;
left:0px;
Page – 41
DATA WORLD Computer Training Professional Web Design Course
top:0px;
z-index:-1;
}
</style>
</head>
<body>
<h1>This is a heading</h1>
<img src="w3css.gif" width="100" height="140" />
<p>Because the image has a z-index of -1, it will be placed behind the text.</p>
</body>
</html>
Example:
<style type="text/css">
#div1 {
float: left;
background: #BFFFFF;
border: #00D2D2 1px solid;
padding: 12px;
width: 120px;
height: 60px;
}
#div2 {
float: right;
background: #FFD9F8;
border: #F0F 1px solid;
padding: 12px;
width: 120px;
height: 60px;
}
Page – 42
DATA WORLD Computer Training Professional Web Design Course
</style>
<div id="div1">div content ...</div>
<div id="div2">div content ...</div>
Page – 43
DATA WORLD Computer Training Professional Web Design Course
Page – 44
DATA WORLD Computer Training Professional Web Design Course
The example above does not display equally in all browsers. IE and Opera will display the image-marker a
little bit higher than Firefox, Chrome, and Safari.
Crossbrowser Solution
ul
{
list-style-type:none;
padding:0px;
margin:0px;
}
ul li
{
background-image: url(images/smallGradCap.png);
background-repeat:no-repeat;
background-position:0px5px;
padding-left:14px;
}
Page – 45
DATA WORLD Computer Training Professional Web Design Course
<tr>
<td>Cell data</td>
<td>Cell data</td>
</tr>
</table>
Type Selector
Group Selector
Page – 46
DATA WORLD Computer Training Professional Web Design Course
<div>
<h3>Some Stuff</h3>
<p>Stuff inside my paragraph...<span>red text</span></p>
</div>
Class Selector
- All Elements Class Selection
- Element Type Class Selection
ID Selector
Page – 47
DATA WORLD Computer Training Professional Web Design Course
color: #09C;
}
</style>
<p>Once upon a time on a website...</p>
<p>Later that same afternoon a great big...</p>
Example:
<html>
<head>
<style type="text/css">
a.one:link {color:#ff0000;}
a.one:visited {color:#0000ff;}
a.one:hover {color:#ffcc00;}
a.two:link {color:#ff0000;}
a.two:visited {color:#0000ff;}
a.two:hover {font-size:150%;}
a.three:link {color:#ff0000;}
a.three:visited {color:#0000ff;}
a.three:hover {background:#66ff66;}
a.four:link {color:#ff0000;}
a.four:visited {color:#0000ff;}
Page – 48
DATA WORLD Computer Training Professional Web Design Course
a.four:hover {font-family:monospace;}
a.five:link {color:#ff0000;text-decoration:none;}
a.five:visited {color:#0000ff;text-decoration:none;}
a.five:hover {text-decoration:underline;}
</style>
</head>
<body>
<p>Mouse over the links to see them change layout.</p>
<p><b><a class="one" href="default.asp" target="_blank">This link changes color</a></b></p>
<p><b><a class="two" href="default.asp" target="_blank">This link changes font-size</a></b></p>
<p><b><a class="three" href="default.asp" target="_blank">This link changes background-color</a></b></p>
<p><b><a class="four" href="default.asp" target="_blank">This link changes font-family</a></b></p>
<p><b><a class="five" href="default.asp" target="_blank">This link changes text-decoration</a></b></p>
</body>
</html>
Universal Selector
Example:
* {color:#F00;}
Example:
#div2 * {
color:#F0F;
font-weight:bold;
}
Child Combinator
Example:
<style type="text/css">
div > .p1 {
border-bottom: #09F 1px dashed;
}
</style>
<div>
<h3>Some Content</h3>
<p class="p1">Content inside my paragraph...</p>
<p class="p1">Content inside my paragraph...</p>
</div>
<div>
<h3>More Content</h3>
<p class="p1">Content inside my paragraph...</p>
<p>Content inside my paragraph...</p>
</div>
Page – 49
DATA WORLD Computer Training Professional Web Design Course
text-decoration:underline;
}
</style>
<h3>Some Stuff</h3>
<p>Stuff inside my paragraph...</p>
<p>Stuff inside my paragraph...</p>
<p>Stuff inside my paragraph...</p>
<h3>More Stuff</h3>
<p>Stuff inside my paragraph...</p>
<p>Stuff inside my paragraph...</p>
<p>Stuff inside my paragraph...</p>
Page – 50
DATA WORLD Computer Training Professional Web Design Course
First-Child Selector
first-chil structural pseudo-class selector is used to target and style the first child of its parent element.
Example:
<style type="text/css">
div:first-child {
color:#F0F;
font-weight:bold;
}
</style>
<div>
<p>Paragraph content...</p>
<p>Paragraph content...</p>
</div>
<div>
<p>Paragraph content...</p>
<p>Paragraph content...</p>
</div>
Example:
<style type="text/css">
div p:first-child {
color:#F0F;
font-weight:bold;
}
</style>
<div>
<p>Paragraph content...</p>
<p>Paragraph content...</p>
</div>
<div>
<p>Paragraph content...</p>
<p>Paragraph content...</p>
</div>
Attribute Selector
Example:
<style type="text/css">
p[title] { color:#F0F; font-weight:bold; }
div[lang] { color:#090; font-weight:bold; }
</style>
<p title="My Title">content...</p>
<p id="p1">content...</p>
<div lang="en">content...</div>
Nesting Selectors
Example:
<html>
<head>
Page – 51
DATA WORLD Computer Training Professional Web Design Course
<style type="text/css">
p
{
color:blue;
text-align:center;
}
.marked
{
background-color:red;
}
.marked p
{
color:white;
}
</style>
</head>
<body>
<p>This is a blue, center-aligned paragraph.</p>
<div class="marked">
<p>This p element should not be blue.</p>
</div>
<p>p elements inside a "marked" classed element keeps the alignment style, but has a different text color.</p>
</body>
</html>
Navigation Bar
<html>
<head>
<style>
ul
{
list-style-type:none;
margin:0;
padding:0;
}
li
{
float:left;
}
a:link,a:visited
{
display:block;
width:120px;
font-weight:bold;
color:#FFFFFF;
background-color:#98bf21;
text-align:center;
padding:4px;
Page – 52
DATA WORLD Computer Training Professional Web Design Course
text-decoration:none;
text-transform:uppercase;
}
a:hover,a:active
{
background-color:#7A991A;
}
</style>
</head>
<body>
<ul>
<li><a href="#home">Home</a></li>
<li><a href="#news">News</a></li>
<li><a href="#contact">Contact</a></li>
<li><a href="#about">About</a></li>
</ul>
</body>
</html>
Image Glary
<html>
<head>
<style type="text/css">
div.img
{
margin:2px;
border:1px solid #0000ff;
height:auto;
width:auto;
float:left;
text-align:center;
}
div.img img
{
display:inline;
margin:3px;
border:1px solid #ffffff;
}
div.img a:hover img
{
border:1px solid #0000ff;
}
div.desc
{
text-align:center;
font-weight:normal;
width:120px;
margin:2px;
Page – 53
DATA WORLD Computer Training Professional Web Design Course
}
</style>
</head>
<body>
<div class="img">
<a target="_blank" href="klematis_big.htm">
<img src="klematis_small.jpg" alt="Klematis" width="110" height="90" />
</a>
<div class="desc">Add a description of the image here</div>
</div>
<div class="img">
<a target="_blank" href="klematis2_big.htm">
<img src="klematis2_small.jpg" alt="Klematis" width="110" height="90" />
</a>
<div class="desc">Add a description of the image here</div>
</div>
<div class="img">
<a target="_blank" href="klematis3_big.htm">
<img src="klematis3_small.jpg" alt="Klematis" width="110" height="90" />
</a>
<div class="desc">Add a description of the image here</div>
</div>
<div class="img">
<a target="_blank" href="klematis4_big.htm">
<img src="klematis4_small.jpg" alt="Klematis" width="110" height="90" />
</a>
<div class="desc">Add a description of the image here</div>
</div>
</body>
</html>
Page – 54
DATA WORLD Computer Training Professional Web Design Course
#myMenu div ul {
display: none;
position: absolute;
list-style-type:none;
background-color: #999;
border: #666;
top: 85px;
padding: 0px;
}
#myMenu div:hover ul {
display: block;
font-size:12px;
}
#myMenu div ul li a {
display: block;
width: 120px;
background: #F0F0F0;
margin: 1px;
padding: 4px;
text-decoration: none;
color:#000;
}
#myMenu div ul li a:hover {
background: #FFEFB7;
color:#960;
}
</style>
</head>
<body>
<h1>My Web Document</h1>
<div id="myMenu">
<div>
<a href="#">Home</a>
</div>
<div>
<a href="#">Services</a>
<ul>
<li><a href="#">Face Punching</a></li>
<li><a href="#">Teeth Kicking</a></li>
<li><a href="#">Butt Munching</a></li>
</ul>
</div>
<div>
<a href="#">Locations</a>
<ul>
<li><a href="#">New York</a></li>
<li><a href="#">Chicago</a></li>
</ul>
Page – 55
DATA WORLD Computer Training Professional Web Design Course
</div>
</div>
<p>And here my document content continues down the page ...</p>
</body>
</html>
Example:
<html>
<head>
<title>CSS Drop-Down Menu</title>
<style>
.nav,.sub {
font-family:Arial, Helvetica, sans-serif;
list-style:none;
margin:0;
padding:0;
}
.nav li {
background:#32CD32;
height:30px;
line-height:30px;
text-align:center;
width:150px;
}
.nav li a {
display:block;
text-decoration:none;
color:#FFFFFF;
}
.nav li a:hover {
background:#2E8B57;
}
.nav > li {
border-right:1px solid #FFFFFF;
float:left;
}
.sub {
display:none;
}
.nav > li:hover .sub {
display:block;
}
.sub li {
border-top:1px solid #FFFFFF;
}
</style>
</head>
<body>
Page – 56
DATA WORLD Computer Training Professional Web Design Course
<div id="mainmenu">
<ul class="nav">
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li>
<a href="#">Services</a>
<ul class="sub">
<li><a href="#">Training</a></li>
<li><a href="#">Web Development</a></li>
<li><a href="#">Soft Development</a></li>
</ul>
</li>
<li><a href="#">Products</a>
<ul class="sub">
<li><a href="#">CMS Software</a></li>
<li><a href="#">SMS Software</a></li>
<li><a href="#">RMS Software</a></li>
<li><a href="#">IAS Software</a></li>
<li><a href="#">HSMS Software</a></li>
</ul>
</li>
<li><a href="#">Contact</a></li>
</ul>
</div>
</body>
</html>
Introduction to JavaScript
JavaScript is used in millions of Web pages to improve the design, validate forms, detect browsers, create cookies, and
much more.
JavaScript is the most popular scripting language on the internet, and works in all major browsers, such as Internet Explorer,
Mozilla , Firefox, Netscape, and Opera.
What is JavaScript?
JavaScript was designed to add interactivity to HTML pages
JavaScript is a scripting language
A scripting language is a lightweight programming language
A JavaScript consists of lines of executable computer code
A JavaScript is usually embedded directly into HTML pages
JavaScript is an interpreted language (means that scripts execute without preliminary compilation)
Everyone can use JavaScript without purchasing a license
</script>
</body>
</html>
<html>
<head>
</head>
<body>
<script type="text/javascript">
....
</script>
</body>
Using an External JavaScript
Sometimes you might want to run the same JavaScript on several pages, without having to write the same script on every
page.
To simplify this, you can write a JavaScript in an external file. Save the external JavaScript file with a .js file extension.
Note: The external script cannot contain the <script> tag!
To use the external script, point to the .js file in the "src" attribute of the <script> tag:
Page – 58
DATA WORLD Computer Training Professional Web Design Course
<html>
<head>
<script src="xxx.js"></script>
</head>
<body>
</body>
</html>
JavaScript Statements
JavaScript is a sequence of statements to be executed by the browser.
JavaScript Statements
A JavaScript statements is a command to the browser. The purpose of the command is to tell the browser what to do.
Note: Using semicolons makes it possible to write multiple statements on one line.
function functionname()
{
some code
}
Note: Do not forget about the importance of capitals in JavaScript! The word function must be written in lowercase letters,
otherwise a JavaScript error occurs! Also note that you must call a function with the exact same capitals as in the function
name.
<html>
<body>
<h1>My Web Page</h1>
<p id="demo">A Paragraph.</p>
<script type="text/javascript">
document.getElementById("demo").innerHTML="My First JavaScript";
</script>
</body>
</html>
<html>
<body>
<h1>My First Web Page</h1>
<p>My First Paragraph.</p>
<button onclick="myFunction()">Try it</button>
<script type="text/javascript">
function myFunction()
{
Page – 59
DATA WORLD Computer Training Professional Web Design Course
JavaScript Comments
Comments can be added to explain the JavaScript, or to make it more readable.
Single line comments start with //.
JavaScript Multi-Line Comments
Multi line comments start with /* and end with */.
JavaScript Variables
Variables are "containers" for storing information: x=5; length=66.10;
NOTE: Because JavaScript is case-sensitive, variable names are case-sensitive.
Declaring (Creating) JavaScript Variables
Creating variables in JavaScript is most often referred to as "declaring" variables.
You can declare JavaScript variables with the var statement:
var x;
var carname;
After the declaration shown above, the variables has no values, but you can assign values to the variables while you declare
them:
var x=5;
var carname="Volvo";
Note: When you assign a text value to a variable, you use quotes around the value.
<html>
<body>
<p>Click the button to create a variable, and display the result.</p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script type="text/javascript">
function myFunction()
{
var carname="Volvo";
document.getElementById("demo").innerHTML=carname;
}
</script>
</body>
</html>
JavaScript Arithmetic
As with algebra, you can do arithmetic with JavaScript variables:
y=x-5;
z=y+5;
JavaScript Operators
The operator = is used to assign values.
The operator + is used to add values.
Page – 60
DATA WORLD Computer Training Professional Web Design Course
<html>
<body>
<p>Given that y=5, calculate x=y+2, and display the result.</p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script type="text/javascript">
function myFunction()
{
var y=5;
var x=y+2;
var demoP=document.getElementById("demo")
demoP.innerHTML="x=" + x;
}
</script>
</body>
</html>
x="5"+"5";
document.write(x);
x=5+"5";
document.write(x);
x="5"+5;
document.write(x);
JavaScript Comparison and Logical Operators
Comparison and Logical operators are used to test for true or false.
Comparison Operators
Comparison operators are used in logical statements to determine equality or difference between variables or values.
Given that x=5, the table below explains the comparison operators:
Operator Description Example
== is equal to x==8 is false
=== is exactly equal to (value and type) x==5istrue
x==="5" is false
!= is not equal x!=8 is true
> is greater than x>8 is false
< is less than x<8 is true
>= is greater than or equal to x>=8 is false
<= is less than or equal to x<=8 is true
How Can it be Used
Comparison operators can be used in conditional statements to compare values and take action depending on the result:
if (age<18) document.write("Too young");
Logical Operators
Logical operators are used in determine the logic between variables or values.
Given that x=6 and y=3, the table below explains the logical operators:
Operator Description Example
&& and (x < 10 && y > 1) is true
|| or (x==5 || y==5) is false
Page – 62
DATA WORLD Computer Training Professional Web Design Course
Conditional Operator
JavaScript also contains a conditional operator that assigns a value to a variable based on some condition.
Syntax
variablename=(condition)?value1:value2
<html>
<body>
<p>Click the button to check the age.</p>
Age:<input id="age" value="18" />
<p>Old enough to vote?</p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script type="text/javascript">
function myFunction()
{
var age,voteable;
age=document.getElementById("age").value;
voteable=(age<18)?"Too young":"Old enough";
document.getElementById("demo").innerHTML=voteable;
}
</script>
</body>
</html>
Conditional Statements
Very often when you write code, you want to perform different actions for different decisions. You can use conditional
statements in your code to do this.In JavaScript we have the following conditional statements:
if statement - use this statement if you want to execute some code only if a specified condition is true
if...else statement - use this statement if you want to execute some code if the condition is true and another code if
the condition is false
if...else if....else statement - use this statement if you want to select one of many blocks of code to be executed
switch statement - use this statement if you want to select one of many blocks of code to be executed
If Statement
Note that if is written in lowercase letters. Using uppercase letters (IF) will generate a JavaScript error!
<script type="text/javascript">
//Write a "Good morning" greeting if //the time is less than 10
var d=new Date();
var time=d.getHours();
if (time<10)
{
document.write("<b>Good morning</b>");
}
</script>
Page – 63
DATA WORLD Computer Training Professional Web Design Course
<script type="text/javascript">
//Write "Lunch-time!" if the time is 11
var d=new Date();
var time=d.getHours();
if (time==11)
{
document.write("<b>Lunch-time!</b>");
}
</script>
If...else Statement
<script type="text/javascript">
//If the time is less than 10,
//you will get a "Good morning" greeting.
//Otherwise you will get a "Good day" greeting.
var d = new Date();
var time = d.getHours();
if (time < 10)
{
document.write("Good morning!");
}
else
{
document.write("Good day!");
}
</script>
Page – 64
DATA WORLD Computer Training Professional Web Design Course
Confirm Box
Syntax:
confirm("sometext");
Prompt Box
Syntax:
prompt("sometext","defaultvalue");
Page – 65
DATA WORLD Computer Training Professional Web Design Course
product=prod(2,3);
The returned value from the prod() function is 6, and it will be stored in the variable called product.
<html>
<body>
<p>This example calls a function which perfoms a calculation, and returns the result:</p>
<p id="demo"></p>
<script>
function myFunction(a,b)
{
return a*b;
}
document.getElementById("demo").innerHTML=myFunction(4,3);
</script>
</body>
</html>
Page – 66
DATA WORLD Computer Training Professional Web Design Course
<body>
<p id="demo"></p>
<input type="button" onclick="myFunctionAlert()" value="Show alert box" />
<input type="button" onclick="myFunctionComfirm()" value="Show comfirm box" />
<input type="button" onclick="myFunctionPrompt()" value="Show prompt box" />
</body>
</html>
<html>
<body>
<p>Click the button to loop through a block of as long as <em>i</em> is less than 5.</p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction()
{
var x="",i=0;
do
{
x=x + "The number is " + i + "<br />";
i++;
}
Page – 67
DATA WORLD Computer Training Professional Web Design Course
while (i<5)
document.getElementById("demo").innerHTML=x;
}
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
div
{
border: 1px solid #FF0000;
}
</style>
<script>
function changeMargin()
{
document.getElementById("ex1").style.margin="100px";
}
function changePadding()
{
document.getElementById("ex2").style.padding="100px";
}
</script>
</head>
<body>
<div id="ex1">This is some text.</div>
<br />
<button type="button" onclick="changeMargin()">Change margin of the div element</button>
<br />
<br />
<div id="ex2">This is some text.</div>
<br />
<button type="button" onclick="changePadding()">Change padding of the div element</button>
</body>
</html>
Examples:
<script>
function A()
{document.bgColor="Maroon";}
function B()
{document.fgColor="Teal";}
function C()
{document.title="hello";}
</script>
-----------------------------------------------------------------------
Page – 68
DATA WORLD Computer Training Professional Web Design Course
<script>
var d=new Date();
var myday=d.getDay();
var mymonth=d.getMonth();
switch(myday)
{
case 0:document.write("today is sunday<br>");break;
case 1:document.write("today is monday<br>");break;
case 2:document.write("today is tuesday<br>");break;
case 3:document.write("today is wedanday<br>");break;
case 4:document.write("today is thurday<br>");break;
case 5:document.write("today is friday<br>");break;
case 6:document.write("today is sataday<br>");break;
}
switch(mymonth)
{
case 0:document.write("month is january<br>");break;
case 1:document.write("month is february<br>");break;
case 2:document.write("month is march<br>");break;
case 3:document.write("month is april<br>");break;
case 4:document.write("month is may<br>");break;
Page – 69
DATA WORLD Computer Training Professional Web Design Course
</form>
</body>
</html>
------------------------------------------------------------------------------------------
<html>
<head>
<script>
var str="This is a String";
document.write(str.length+"<br>");
document.write(str.bold()+"<br>");
document.write(str.italics()+"<br>");
document.write(str.sup()+"<br>");
document.write(str.sub()+"<br>");
document.write(str.toUpperCase()+"<br>");
Page – 70
DATA WORLD Computer Training Professional Web Design Course
document.write(str.toLowerCase()+"<br>");
document.write(str.fontcolor("red")+"<br>");
document.write(str.fontcolor("green").fontsize("16")+"<br>");
document.write(str.charAt(15).toUpperCase().fontcolor("blue")+"<>");
document.write(str.substr(0,4).toUpperCase()+"<br>");
</script>
</head>
<body>
<h1 align= center>String Object Testing</h1>
</body>
</html>
--------------------------------------------------------------------------------------
<html>
<head>
<script>
function A()
{
document.pic.src="images/dog2.jpg";
}
function B()
{document.pic.src="images/dog1.jpg";}
</script>
<body>
<img src=images\dog1.jpg onMouseOver="A()" onMouseOut="B()" name=pic>
</body>
</html>
Page – 71