Search In Site

Showing posts with label html tutorials. Show all posts
Showing posts with label html tutorials. Show all posts

04 July, 2013

Attributes In Html


Core Attributes:
The four core attributes that can be used on the majority of HTML elements (although not all) are:

  •  id
  •  title
  •  class
  •  style

The id Attribute:
The id attribute can be used to uniquely identify any element within a page ( or style sheet ). There are two primary reasons that you might want to use an id attribute on an element:

  • If an element carries an id attribute as a unique identifier it is possible to identify just that element and its content.
  • If you have two elements of the same name within a Web page (or style sheet), you can use the id attribute to distinguish between elements that have the same name.
  • We will discuss style sheet in separate tutorial. For now, the id attribute could be used to distinguish between two paragraph elements, like so: <p id="html">This para explains what is HTML</p> <p id="css">This para explains what is Casecading Style Sheet</p>
  • Note that there are some special rules for the value of the id attribute, it must:
  • Begin with a letter (A.Z or a.z) and can then be followed by any number of letters, digits (0.9), hyphens, underscores, colons, and periods.
  • Remain unique within that document; no two attributes may have the same value within that HTML document.

The title Attribute:
The title attribute gives a suggested title for the element. They syntax for the title attribute is similar as explained for id attribute:
The behavior of this attribute will depend upon the element that carries it, although it is often displayed as a tooltip or while the element is loading.
For example: <h4 title="Hello HTML!">Titled Heading Tag Example</h4>
Above code will generate following result: Titled Heading Tag Example
Now try to bring your cursor over "Titled Heading Tag Example" and see the result.

The class Attribute:
The class attribute is used to associate an element with a style sheet, and specifies the class of element. You learn more about the use of the class attribute when you will learn Casecading Style Sheet (CSS). So for now you can avoid it.
The value of the attribute may also be a space-separated list of class names. For example: class="className1 className2 className3"

The style Attribute:
The style attribute allows you to specify CSS rules within the element. For example: <p style="font-family:arial; color:#FF0000;">Some text...</p>

Internationalization Attributes:
There are three internationalization attributes, which are available to most (although not all) XHTML elements.

  1.  dir
  2.  lang
  3.  xml:lang

The dir Attribute:
The dir attribute allows you to indicate to the browser the direction in which the text should flow.The dir attribute can take one of two values, as you can see in the table that follows: Value Meaning ltr Left to right (the default value)
rtl Right to left (for languages such as Hebrew or Arabic that are read right to left)
Example: <html dir=rtl> <head> <title>Display Directions</title> </head> <body> This is how IE 5 renders right-to-left directed text. </body> </html>
When dir attribute is used within the <html> tag, it determines how text will be presented within the entire document. When used within another tag, it controls the text's direction for just the content of that tag.

The lang Attribute:
The lang attribute allows you to indicate the main language used in a document, but this attribute was kept in HTML only for backwards compatibility with earlier versions of HTML. This attribute has been replaced by the xml:lang attribute in new XHTML documents.
When included within the <html> tag, the lang attribute specifies the language you've generally used within the document. When used within other tags, the lang attribute specifies the language you used within that tag's content. Ideally, the browser will use lang to better render the text for the user.
The values of the lang attribute are ISO-639 standard two-character language codes.Check HTML Language Codes: ISO 639 for a complete list of language codes.
Example: <html lang=en> <head> <title>English Language Page</title> </head> <body> This page is using English Language </body> </html>

The xml:lang Attribute:
The xml:lang attribute is the XHTML replacement for the lang attribute. The value of the xml:lang attribute should be an ISO-639 country code as mentioned in previous section.


Generic Attributes:
Here's a table of some other attributes that are readily usable with many of HTML's tags.


Attributes
Option
Function
Align
Right, Left, Center
Horizontally Aligns Tags
Valign
Top, Middle, Bottom
Vertically Aligns Tags Within An Html Element.
Bgcolor
Numeric, Hexidecimal, Rgb Values
Places A Background Color Behind An Element
Background
Url
Places An Background Image Behind An Element
Id
User Defined
Names An Element For Use With Cascading Style Sheets.
Class
User Defined
Classifies An Element For Use With Cascading Style Sheets.
Width
Numeric Value
Specifies The Width Of Tables, Images, Or Table Cells.
Height
Numeric Value
Specifies The Height Of Tables, Images, Or Table Cells.
Title
User Defined
"Pop-Up" Title For Your Elements.

03 July, 2013

HTML Meta Tags And Attributes


HTML Meta Tags
HTML lets you specify metadata - information about a document rather than document content -in a variety of ways. The META element can be used to include name/value pairs describing properties of the HTML document, such as author, Expiry Date, a list of key words, author etc. The <meta> tag is an empty element and so does not have a closing tag, rather, <meta> tags carry information within attributes, so you need a forward slash character at the end of the element. Metadata provided by using meta tag is a very important part of the web. It can assist search engines in finding the best match when a user performs a search. Search engines will often look at any metadata attached to a page - especially keywords - and rank it higher than another page with less relevant metadata, or with no metadata at all.

Adding Meta Tags to Your Documents:

You can add metadata to your web pages by placing <meta> tags between the <head> and </head> tags. The can include the following attributes:
Name:-Name for the property. Can be anything. Examples include, keywords, description, author, revised, generator etc.
content:- Specifies the property's value.
scheme:- Specifies a scheme to use to interpret the property's value (as declared in the content attribute).
Http-equiv:- Used for http response message headers. For example http-equiv can be used to refresh the page or to set a cookie. Values include content-type, expires, refresh and set-cookie.
Let's see few important usage of Meta Tags.
Specifying Keywords:
We specify keywords which will be used by the search engine to search a web page. So using following tag you can specify important keywords related to your page. <head> <meta name="keywords" content="HTML, meta tags, metadata" /> </head>
Document Description:
This is again important information and many search engine use this information as well while searching a web page. So you should give an appropriate description of the page.
<head> <meta name="description" content="Learn about Meta Tags." /> </head>
Document Revision date:
This information tells about last time the document was updated.
<head> <meta name="revised" content="Tutorialspoint, 6/12/2006" /> </head>
Document Refreshing:
You can specify a duration after which your web page will keep refreshing. If you want your page keep refreshing after every 10 seconds then use the following syntax.
<head> <meta http-equiv="refresh" content="10" /> </head>
Page Redirection:
You can specify a page redirection using Meta Tag. Following is an example of redirecting current page to another page. You can specify a duration after which page will be redirected.
<head> <meta http-equiv="refresh" content="10; url=http://www.tutorialspoint.com" /> </head>
If you don't provide a duration then page will be redirected immediately.
Setting Cookies:
You can use Meta Tag to store cookies on client side later information can be used by then Web Server to track a site visitor.
<head> <meta http-equiv="cookie" content="userid=xyz; expires=Wednesday, 08-Aug-00 23:59:59 GMT; /> </head>
If you do not include the expiration date and time, the cookie is considered a session cookie and will be deleted when the user exits the browser.
Check PHP and Cookies tutorial for a complete detail on Cookies.
Setting Author Name:
You can set an author name in a web page using Meta Tag. See an example below:
<head> <meta name="author" content="Mahnaz Mohtashim" /> </head>
If you do not include the expiration date and time, the cookie is considered a session cookie and will be deleted when the user exits the browser.

HTML Attributes
Attributes are another important part of HTML markup. An attribute is used to define the characteristics of an element and is placed inside the element's opening tag. All attributes are made up of two parts: a name and a value:

  •  The name is the property you want to set. For example, the <font> element in the example carries an attribute whose name is face, which you can use to indicate which typeface you want the text to appear in.
  •  The value is what you want the value of the property to be. The first example was supposed to use the Arial typeface, so the value of the face attribute is Arial.

The value of the attribute should be put in double quotation marks, and is separated from the name by the equals sign. You can see that a color for the text has been specified as well as the typeface in this <font> element:
<font face="arial" color="#CC0000">
Many HTML tags have a unique set of their own attributes. These will be discussed as each tag is introduced throughout the tutorial. Right now we want to focus on a set of generic attributes that can be used with just about every HTML Tag in existence.

HTML Document: Basic Tags And Elements


Creating an HTML document is easy. To begin coding HTML you need only two things: a simple-text editor and a web browser. Notepad is the most basic of simple-text editors and you will probably code a fair amount of HTML with it. You can use our HTML Online Editor to learn HTML. Here are the simple steps to create a baisc HTML document:

  •  Open Notepad or another text editor.
  •  At the top of the page type <html>.
  •  On the next line, indent five spaces and now add the opening header tag: <head>.
  •  On the next line, indent ten spaces and type <title> </title>.
  •  Go to the next line, indent five spaces from the margin and insert the closing header tag: </head>.
  •  Five spaces in from the margin on the next line, type<body>.
  •  Now drop down another line and type the closing tag right below its mate: </body>.
  •  Finally, go to the next line and type </html>.
  •  In the File menu, choose Save As.
  •  In the Save as Type option box, choose All Files.
  •  Name the file template.htm.
  •  Click Save.

You have basic HTML document now, to see some result put the following code in title and body tags. 
<html>
<head>
<title>This is document title</title> 
</head> 
<body> <h1>This is a heading</h1> <p>Document description goes here.....</p> </body> 
</html>
Now you have created one HTML page and you can use a Web Browser to open this HTML file to see the result. Hope you understood that Web Pages are nothing but they are simple HTML files with some content which can be rendered using Web Browsers. 

HTML Document Structure:
An HTML document starts and ends with <html> and >/html> tags. These tags tell the browser that the entire document is composed in HTML. Inside these two tags, the document is split into two sections:
 The <head>...</head> elements, which contain information about the document such as title of the document, author of the document etc. Information inside this tag does not display outside.
 The <body>...</body> elements, which contain the real content of the document that you see on your screen.

HTML Tags and Elements:
HTML language is a markup language and we use many tags to markup text. In the above example you have seen <html>, <body> etc. are called HTML tags or HTML elements. Every tag consists of a tag name, sometimes followed by an optional list of tag attributes , all placed between opening and closing brackets (< and >). The simplest tag is nothing more than a name  appropriately enclosed in brackets, such as <head> and <i>. More complicated tags contain one or more attributes , which specify or modify the behaviour of the tag. According to the HTML standard, tag and attribute names are not case-sensitive. There's no difference in effect between <head>, <Head>, <HEAD>, or even <HeaD>; they are all equivalent. But with XHTML, case is important: all current standard tag and attribute names are in lowercase.

HTML is Forgiving?
A very good quality associated with all the browsers is that they would not give any error if you have not put any HTML tag or attribute properly. They will just ignore that tag or attribute and will apply only correct tags and attributes before displaying the result. We can not say, HTML is forgiving because this is just a markup language and required to format documents.

HTML Basic Tags
The basic structure for all HTML documents is simple and should include the following minimum elements or tags:
 <html> - The main container for HTML pages
 <head> - The container for page header information
 <title> - The title of the page
 <body> - The main body of the page
Remember that before an opening <html> tag, an XHTML document can contain the optional XML declaration, and it should always contain a DOCTYPE declaration indicating which version of XHTML it uses. Now we will explain each of these tags one by one. In this tutorial you will find the terms element and tag are used interchangeably.

The <html> Element:
The <html> element is the containing element for the whole HTML document. Each HTML document should have one <html> and each document should end with a closing </html> tag.
Following two elements appear as direct children of an <html> element:
 <head>
 <body>
As such, start and end HTML tags enclose all the other HTML tags you use to describe the Web page.

The <head> Element:
The <head> element is just a container for all other header elements. It should be the first thing to appear after the opening <html> tag.
Each <head> element should contain a <title> element indicating the title of the document, although it may also contain any combination of the following elements, in any order:

  •  The <base> tag is used to areate a "base" url for all links on the page. Check HTML Base tag.
  •  The <object> tag is designed to include images, JavaScript objects, Flash animations, MP3 files, QuickTime movies and other components of a page. Check HTML Object tag.
  •  The <link> tag is used to link to an external file, such as a style sheet or JavaScript file. Check HTML Link tag.
  •  The <style> tag is used to include CSS rules inside the document. Check HTML Style tag.
  •  The <script> tag is used to include JAVAScript or VBScript inside the document. Check HTML Script tag.
  •  The <meta> tag includes information about the document such as keywords and a description, which are particularly helpful for search applications. Check HTML Meta tag.

Example:
Following is the example of head tag.
 <head>
 <title>HTML Basic tags</title> <meta name="Keywords" content="HTML, Web Pages" /> <meta name="description" content="HTML Basic Tags" /> <base href="http://www.tutorialspoint.com" /> <link rel="stylesheet" type="text/css" href="tp.css" /> <script type="text/javascript"> _uacct = "UA-232293"; urchinTracker(); </script>
 </head>

The <title> Element:
You should specify a title for every page that you write inside the <title> element. This element is a child of the <head> element). It is used in several ways:
 It displays at the very top of a browser window.
 It is used as the default name for a bookmark in browsers such as IE and Netscape.  Its is used by search engines that use its content to help index pages. Therefore it is important to use a title that really describes the content of your site. The <title> element should contain only the text for the title and it may not contain any other elements. Here is the example of using title tag.
<head>
<title>HTML Basic tags</title>
</head>

The <body> Element:
The <body> element appears after the <head> element and contains the part of the Web page that you actually see in the main browser window, which is sometimes referred to as body content. A <body> element may contain anything from a couple of paragraphs under a heading to more complicated layouts containing forms and tables. Most of what you will be learning in this and the following five chapters will be written between the opening <body> tag and closing </body> tag. Here is the example of using body tag.
<body> <p>This is a paragraph tag.</p> </body>

Putting all together:
Now if we will put all these tags together, it will constitute a complete HTML document as follows:
<html>
<head>
<title>HTML Basic tags</title> <meta name="Keywords" content="HTML, Web Pages" /> <meta name="description" content="HTML Basic Tags" /> <base href="http://www.tutorialspoint.com" /> <link rel="stylesheet" type="text/css" href="tp.css" /> <script type="text/javascript"> _uacct = "UA-232293"; urchinTracker(); </script> </head> <body> <p>This is a paragraph tag.</p>
</body>
</html>

29 June, 2013

Adding ActiveX Controls To DHTML Pages In Visual Basic

Adding ActiveX Controls To DHTML Pages
You can add ActiveX controls to DHTML pages just as you can to standard Visual Basic projects just use the Project Components menu item to open the Components dialog box and select the ActiveX control you want to add. Then just add that control to the Web page as you would in any standard Visual Basic project.
For example, we add a standard HTML button and a progress bar ActiveX control to the Web page, Here’s the HTML code that the Page Designer adds to our Web page when we add those two new controls, the progress bar and the HTML button:
<P>Here’s an ActiveX control:</P>
<OBJECT classid=CLSID:35053A22-8589-11D1-B16A-00C0F0283628 height=24
id=ProgressBar1
style="HEIGHT: 24px; LEFT: 127px; POSITION: absolute; TOP: 248px; WIDTH:100px; Z-INDEX: 101"width=100>
<PARAM NAME="_ExtentX" VALUE=2646>
<PARAM NAME="_ExtentY" VALUE="635">
<PARAM NAME="_Version" VALUE="393216">
<PARAM NAME="BorderStyle" VALUE="0">
<PARAM NAME="Appearance" VALUE="1">
<PARAM NAME="MousePointer" VALUE="0">
<PARAM NAME="Enabled" VALUE="1">
<PARAM NAME="OLEDropMode" VALUE="0">
<PARAM NAME="Min" VALUE="0">
<PARAM NAME="Max" VALUE="100">
<PARAM NAME="Orientation" VALUE="0">
<PARAM NAME="Scrolling" VALUE="0">
</OBJECT>
<INPUT id=Button1 name=Button1 style="LEFT: 26px; POSITION: absolute; TOP:
248px; Z-INDEX: 102" type=button value="Click Me!">
Now we’re free to use the HTML button to set the progress bar’s value like this, just as you would in a standard Visual Basic project:
Private Function Button1_onclick() As Boolean
ProgressBar1.Value = 20
End Function

22 June, 2013

Html : frames


A frame is a distinct section in a browser window. This section can be independent of the other sections in the window, and if we allow it, it can be resized. Like just about everything we've covered so far, making a web site with frames is easy. In fact, many people think creating tables are harder!
Creating frames is just a little different from making normal web pages. To make a frame, we need to create a frame layout page that links to the divisions of the page. On the layout page we put the <FRAMESET> and <FRAME> tags that tell the browser how to display the frames.
The <FRAMESET> tag has 3 attributes, ROWS, COLS and FRAMEBORDER. The ROWS attribute tells the browser "I (number) rows of frames, this size" by putting it into the <FRAMESET> tag like this: <FRAMESET ROWS="33%, 33%, 34%">. This would put 3 different frames on the page, separated like rows in a table. The COLS attribute works similarly, except it divides the page into columns instead of rows.
The FRAMEBORDER attribute specifies whether you want your frame to have borders or not. This attribute's use is a bit restricted though: you can only pass it either 0 or 1 as an argument. FRAMEBORDER="0" eliminates borders, and FRAMEBORDER="1" turns borders on.
So far, our bare-bones frame layout page looks like this:
<HTML>
<HEAD>
<TITLE>Welcome to Little v's frame demo!</TITLE>
</HEAD>

<FRAMESET COLS="40%, 60%">
</FRAMESET>

</HTML>
Notice anything missing? Yep, the BODY! However, this is justified: since this is just a frame layout and not an actual page with information, it really does'nt have a body. Hmm, that did'nt sound too healthy. Oh well, now for the business of displaying our actual frames.
To define the content of the two frames that we just created, we need to use the <FRAME> tag. The FRAME tag has a few attributes that give us extensive control of our frames. The most important attribute is the SRC attribute. This attribute gives the location of the HTML file to be displayed in the frame. Basically, <FRAME SRC> works for frames the same as <IMG SRC> does for images.
After the mandatory SRC tag, there are a few more attributes to the <FRAME> tag that we can use to give us control over how our frame is displayed. We can toggle the borders on or off in our individual frames by putting the FRAMEBORDER attribute in the <FRAME> tag. We can change the margins in our frame with the MARGINHEIGHT and MARGINWIDTH attributes. The proper way to set a margin is like this:
<FRAME MARGINWIDTH="x">
Where x is any number. What is we want our frame to be fixed so the browser cannot resize it? We could tape up the browser's keyboard, or we could use the NORESIZE attribute. This attribute takes no arguments, and when placed in the <FRAME> tag, it locks out the resize option in the browser. If we want to get really specific as to the display of our frame, we can use the SCROLLING attribute to set whether the browser shows a scrollbar. We can either pass SCROLLING a yes, no, or an auto (sorry, no maybe's!). Auto allows the viewer's browser to determine whether or not it needs a scrollbar. The default is auto.
When we apply what we just learned and update our "bare-bones" frame layout, the code looks like this:
<HTML>
<HEAD>
<TITLE>Welcome to Little v's frame demo!</TITLE>
</HEAD>

<FRAMESET COLS="40%, 60%" FRAMEBORDER="0">
<FRAME SRC="leftframe.html"> <FRAME SRC="rightframe.html"> </FRAMESET>

</HEAD>
</HTML>

Now if we crank out one page for the left frame and one for the right frame, we'll have something like this.
But what about if our casual browser is surfing with frames off, or even worse, what happens if his browser does'nt even support frames? Always ready with a work-around, HTML offers us the <NOFRAMES> tag. It works like this: anything between the <NOFRAMES> and </NOFRAMES> tags on the frame format page will be shown to browsers that cannot display frames, or have frames turned off. A clever use for this tag would be to add a message with a link to the main page of your site, so these visitors can navigate your site without use of the frames. Something along these lines would work:
<NOFRAMES>
I see you ca'nt see my frames, but you can still navigate my site the old fashioned way! <A HREF="mainpage.html">Click Here!</A>
</NOFRAMES>

Html : Tables

HTML is all about format. HTML is all about format. Just the other day, a friend asked me "Hey little v, is there a way to format a part of my page to look like it's a spreadsheet?" I told him "Heck yeah! Just make a table!".
Here's a little description of tables from a great book, HTML 4 Unleashed by Rick Darnell: "Tables are kind of like lists. We're introduced to them at an early age through the mirth of games such as tic-tac-toe and checkers. Later in life, someone forces us to use a spreadsheet, and suddenly tables are'nt so fun anymore...".
Tables were put in to HTML for the exact reason my friend wanted to use them for - spreadsheets and database information. Later, their features were expanded by developers to include attributes that allow much more than just that. Let's get started with creating a basic table, then get funky with some more advanced techniques!
So how do we start our own HTML spreadsheet? We use the <TABLE> tag!
The <TABLE> tag creates a blank table. It tells the browser "This is the start of a table". There is only one attribute to the <TABLE> tag that we need to worry now: the BORDER attribute. The BORDER attribute tells the browser how wide a border you want around your table data. If you do'nt include the the BORDER attribute into your <TABLE> tag, the browser automatically sets it to BORDER=0, which means there will be no border around your table data.
So our basic table with no data looks like this:
<TABLE BORDER=1>
</TABLE>

What do we have to do to get some data in there? Add cells of course! A cell is a rectangular part of a table that can hold text, HTML tags, and even images! Those of us who use spreadsheets are already familiar with cells. When we make rows and columns in our table, we divide our table into many cells.
To create a row in a table, we use the <TR>, or table row tag. To divide our row into columns, we use the <TD>, or table data tag. You place your cells information after the table data tag.
The HTML for a table with 3 rows and 3 columns is like this:
<TABLE BORDER=1>
<TR><TD>Row 1, Col 1 <TD>Row 1, Col 2 <TD>Row 3, Col 3</TR>
<TR><TD>Row 2, Col 1 <TD>Row 2, Col 2 <TD>Row 3, Col 3</TR>
<TR><TD>Row 3, Col 1 <TD>Row 2, Col 2 <TD>Row 3, Col 3</TR>
</TABLE>

And the table comes out looking like this:
Row 1, Col 1Row 1, Col 2Row 3, Col 3
Row 2, Col 1Row 2, Col 2Row 3, Col 3
Row 3, Col 1Row 2, Col 2Row 3, Col 3

Need a little explanation for your table? Maybe a title for your column? Try a table header! The <TH> tag is used to put a bold header (or headers!) on the top row of your table. It's used like this:
<TABLE BORDER=1>
<TR><TH>9 Cell Table</TR>
<TR><TD>Row 1, Col 1 <TD>Row 1, Col 2 <TD>Row 3, Col 3</TR>
<TR><TD>Row 2, Col 1 <TD>Row 2, Col 2 <TD>Row 3, Col 3</TR>
<TR><TD>Row 3, Col 1 <TD>Row 2, Col 2 <TD>Row 3, Col 3</TR>
</TABLE>

And your browser shows it like so:
9 Cell Table
Row 1, Col 1Row 1, Col 2Row 3, Col 3
Row 2, Col 1Row 2, Col 2Row 3, Col 3
Row 3, Col 1Row 2, Col 2Row 3, Col 3

We can change our table by using a variety of tags. Formatting a table combines parts of page format with image formatting.
Since we already know how to handle size in images, we can directly apply our knowledge to making tables. In our <TABLE> tag, we can add the WIDTH and HEIGHT attributes, just like in an image. For example, if we wanted a table 300 pixels wide and 300 pixels high, we'd code its <TABLE> tag like this:
<TABLE WIDTH="300" HEIGHT="300">
We can also change the height and width of the individual cells by adding the HEIGHT and WIDTH attributes to the <TD> tags. Theres one other way to change our cells size though - we do this by passing the percentage of the table we want our cell to take up. For example, <TD HEIGHT="50%" WIDTH="50%"> makes that cell take up 50 percent of the tables total height and 50 percent of the tables total width.
Following this trend of similarities between images and tables, we can also align data in table in a similar fashion as an image. We just need to add the ALIGN or the VALIGN (vertical align) attributes to our <TR> tags. ALIGN can align our row to the "left", "right", or "center" and VALIGN can align our row to the "top", "middle" or "bottom". If we wanted a cell take up what would normally be a few different cells, we use the COLSPAN attribute. COLSPAN takes as an argument the number of cells that this cell should take up. If I wanted to get a little crazy, I might align a row like this:
<TD ALIGN="right" VALIGN="bottom" COLSPAN="3">
And this would make a cell spanning 3 normal cells, and align our text in that cell to the bottom right portion of our row. How can COLSPAN and ALIGN improve our table? Take a look at our new, improved table and you'll see!
9 Cell Table
Row 1, Col 1Row 1, Col 2Row 3, Col 3
Row 2, Col 1Row 2, Col 2Row 3, Col 3
Row 3, Col 1Row 2, Col 2Row 3, Col 3

As you can see, centering our top heading made our table look just a little better.
Does it get any better than this? Of course! We can give our whole table - or even individual rows or cells - their own background color. Can you guess how (heres a hint - remember how formatting a table is like formatting a page)? If you guessed "Use the BGCOLOR or BACKGROUND attributes" you're right! Do'nt be discouraged - you just learned how! These attributes are just inserted exactly as they would be in the <BODY> tag. So if i wanted the background of my sample table to be blue, and the top row to be red, I would just change the code to look like this:
<TABLE BGCOLOR="blue" BORDER=1>
<TR BGCOLOR="red" ALIGN="center"><TH COLSPAN="3">9 Cell Table</TR>
<TR><TD>Row 1, Col 1 <TD>Row 1, Col 2 <TD>Row 3, Col 3</TR>
<TR><TD>Row 2, Col 1 <TD>Row 2, Col 2 <TD>Row 3, Col 3</TR>
<TR><TD>Row 3, Col 1 <TD>Row 2, Col 2 <TD>Row 3, Col 3</TR>
</TABLE>

And if we take another look it comes out like this:
9 Cell Table
Row 1, Col 1Row 1, Col 2Row 3, Col 3
Row 2, Col 1Row 2, Col 2Row 3, Col 3
Row 3, Col 1Row 2, Col 2Row 3, Col 3

Notice that space is a little tight in those cells? Looks like we gotta add a little space between the borders and the text. How is this done you ask? We need to set the CELLSPACING and CELLPADDING in our table! The CELLSPACING attribute sets the amount of space between cells in our table, in pixels. The CELLPADDING attribute is used to set the amount of space between the cell borders and the cell data. If we add CELLPADDING="0" to our table, it makes the table's data align as closely as possible to the borders. Got it? Let's update our table!
<TABLE BGCOLOR="blue" BORDER=1 CELLSPACING=5 CELLPADDING=10>
<TR BGCOLOR="red" ALIGN="center"><TH COLSPAN="3">9 Cell Table</TR>
<TR><TD>Row 1, Col 1 <TD>Row 1, Col 2 <TD>Row 3, Col 3</TR>
<TR><TD>Row 2, Col 1 <TD>Row 2, Col 2 <TD>Row 3, Col 3</TR>
<TR><TD>Row 3, Col 1 <TD>Row 2, Col 2 <TD>Row 3, Col 3</TR>
</TABLE>

Yields this result:
9 Cell Table
Row 1, Col 1Row 1, Col 2Row 3, Col 3
Row 2, Col 1Row 2, Col 2Row 3, Col 3
Row 3, Col 1Row 2, Col 2Row 3, Col 3

Let's say we want our table to have a little caption that identifies what it is. We can do this by adding a <CAPTION> to our table. It's use is pretty simple, so i'll just show you how it's done.
<TABLE BGCOLOR="blue" BORDER=1 CELLSPACING=5 CELLPADDING=10>
<CAPTION>A sample table</CAPTION> <TR BGCOLOR="red" ALIGN="center"><TH COLSPAN="3">9 Cell Table</TR>
<TR><TD>Row 1, Col 1 <TD>Row 1, Col 2 <TD>Row 3, Col 3</TR>
<TR><TD>Row 2, Col 1 <TD>Row 2, Col 2 <TD>Row 3, Col 3</TR>
<TR><TD>Row 3, Col 1 <TD>Row 2, Col 2 <TD>Row 3, Col 3</TR>
</TABLE>

Makes our table look like so:
A sample table
9 Cell Table
Row 1, Col 1Row 1, Col 2Row 3, Col 3
Row 2, Col 1Row 2, Col 2Row 3, Col 3
Row 3, Col 1Row 2, Col 2Row 3, Col 3

Html : How To Create image maps


Any image that is subdivided into regions that point to different pages is called a Image Map. There are two ways that you can put an image map on your page: by using Client Side image maps or Server Side image maps. Client side scripting is when the coordinates for the image map is stored on an HTML page. Server side image maps store the coordinates for the image map on the page's web server. Because Client Side image map's are quicker loading and easier to understand, we will only explain how to implement Client Side image maps.
When we want to create an image map we use the <MAP> tag. The <MAP> tag, when put in the body part of our page, is our way of telling the browser "I'm going to put an image map on this page". The <MAP> tag takes one attribute: the NAME attribute. The NAME attribute gives our image map a name that we can call it with. It's just like calling a dog, you do'nt call it "dog" it's whole life, you name it something like "spot" and call it by name! Our basic <MAP> tag looks like this:
<MAP NAME="newmap">
Now let's say that I have an image that I want to use on my site as an image map, maybe one that looks something like this:

How do I make it into an imagemap? Well, there's really no physical way to change it into an image map. All that you can do is divide it into areas that link to different pages. We do this by using the <AREA> tag. The <AREA> tag takes three arguments: SHAPE, COORDS, and HREF. SHAPE is easy: it tells the browser what shape the said area is. SHAPE can be given three arguments, "rect" for rectangle areas, "circle" for areas that are circles, and "poly" for polygons that are not rectangles. So far, our <AREA> tag looks like this:
<AREA SHAPE="circle, rect or poly">
So how do we define the actual coordinates of our shape? As you've probably guessed, we use the COORDS attribute. For a rectangle, we have to pass the COORDS attibute the top left and bottom right corners of our linking area.
How do we find these coordinates? Most image editing programs, such as Paint Shop Pro (free to try, my personal favorite!) show you what coordinates you're pointing at on the image. The first coordinate is the "x" or horizontal coordinate, and the second is the "y" or vertical coordinate (just like in algebra class!). I have already opened up my image in Paint Shop Pro and collected that the top left coordinates in the rectangle area of my image (the one surrounding "Disclaimer") are 30 (the "x" coordinate), and 30 (the "y" coordinate). I also got the bottom right coordinates, 194, 69. Now that we've done the hard part (getting the coordinates) all we have to do is pass them to the COORDS attribute. In our area tag, it looks like this:
<AREA SHAPE="rect" COORDS="30,30 , 194,69">
Whew! That's the most work we've done in this whole tutorial! But we're not done yet, we still need to pass where we want this section of our image to point to.
If we want our rectangle area to point somewhere, we're going to have to use one more attribute: HREF. The HREF attribute simply takes the Hypertext Reference(also called a link) that you want to use in this area as an argument. So our complete <AREA> tag looks like this:
<AREA SHAPE="rect" COORDS="30,30 , 194,69" HREF="../disclaimer.html">
(Note: Because our Disclaimer page is in the directory above the current one, if we use relative linking we need to add a '../' before our page name.)
So far we've flagged off the rectangular portion surrounding "Disclaimer" in our image to point to the page "disclaimer.html". But what about that circular portion around "Home"? This one's a simple switch, but let's take it one attribute at a time to make sure we get it.
The SHAPE attribute's argument has to change from "rect" to "circle", since we're no longer flagging off a rectangular area and now using a circular area. To get our coordinates, we're going to have to fire up the old graphics editing program. This time there are no corners to find, so we need to get the coordinates of the center of the circle and its radius (in pixels). For those of you who did'nt take geometry in high school (shame on you!) the radius of a circle is the distance from the center of the circle to any point on the edge of the circle. Paint Shop Pro tells me that the center of my circle's coordinate's are 204, 106. It also tells me that the circle's radius is 57. Knowing this, we can change our <AREA> tag to look like this:
<AREA SHAPE="circle" COORDS="204,106 , 57" HREF="../index.html">
(Note: The "index.html" page, like the "disclaimer.html" page, is in the directory above the current one.)
You may notice that the circle and rectangle overlap a little bit. When there are overlapping area's in an image map, the area that is defined in the source HTML first is considered "on top". So if you click on the overlapping area and our rectangle was the first <AREA> tag in the source HTML, you would be taken to the Disclaimer page.
Wait just one minute! The last area in our image is a triangle? But the SHAPE attribute does'nt take "triangle" as an argument! How do we get around this? With the use of the "poly" argument of course!
The "poly" (or polygon) argument to the SHAPE attribute is used to define areas that are not rectangles or circles. In fact, you can define up to a 100 cornered polygon with the "poly" argument! The poly argument simply takes the coordinates of all the corners in the polygon, and connects them, dot to dot style. Since our lovely triangle has three corners, it has three coordinate pairs: 355,108 (top), 291,174 (bottom left) and 421,174 (bottom right). If we put them into our complete <AREA> tag, it looks like this:
<AREA SHAPE="poly" COORDS="355,108 , 291,174 , 421,174" HREF="../books.html">
Note that the browser automatically connects the last coordinate pair to the first coordinate pair to complete our polygon.
Now we have a complete image map, but what if we want the parts of our image that do'nt point anywhere yet to lead somewhere? That's where the "default" argument to the SHAPE attribute comes in. We could make "default" point somewhere, like this:
<AREA SHAPE="default" HREF="../magazines.html">
This would make the area not in the circle, rectangle or triangle point to "magazines.html" in the directory above the current one. But since I do'nt want this part of the image to point anywhere right now, I use the NOHREF attribute, which simply says "no link in this area!".
Our completed image map code looks like this:
<MAP NAME="newmap">
<AREA SHAPE="rect" COORDS="30,30 , 194,69" HREF="../disclaimer.html">
<AREA SHAPE="circle" COORDS="204,106 , 57" HREF="../main.php3">
<AREA SHAPE="poly" COORDS="355,108 , 291,174 , 421,174" HREF="../books.html">
<AREA SHAPE="default" NOHREF>
</MAP>

To put our image map on the page we use an <IMG> tag with the USEMAP attribute. The USEMAP attribute tells the browser "use this image map". In this example, we're going to pass USEMAP the map that we made and named "newmap", like this:
<IMG SRC="imagemap1.gif" USEMAP="#newmap">
Where imagemap1.gif is the name of my image. Take a look at how we had to put a "#" in front of the name of our map. This is because when you name a map, you flag it off so we can call it later. The "#" tell's the browser that we're going to be using a certain part of an html page. Knowing this, we can use image maps from other pages like this:

<IMG SRC="imagemap1.gif" USEMAP="lesson9.html#newmap">

 
Twitter Bird Gadget