EDUCATION
   
 
EDUCATION :- Computer :- HTML TUTORIAL :- Lession 8
 

Q: How can I control the borders and padding on tables?

To set the borders and padding on a table, you use the BORDER, CELLPADDING, and CELLSPACING attributes in the <TABLE> tag.

BORDER sets the width in pixels of the border around the table.
CELLPADDING sets the number of pixels between the edge of the cell and the text.
CELLSPACING sets the number of pixels between cells.

Example:

<TABLE WIDTH="90%" BORDER="2" CELLPADDING="3" CELLSPACING="2">


Q: How do I make different table cells different colors?

In the <TD> tag, you can add a BGCOLOR attribute to assign a color to a particular cell.

Example:

<td BGCOLOR="#FFFF88">


Q: What are frames?

Frames are a way of displaying more than one web page at once in the same window. Many websites use frames to allow a menu to stay on one side of the screen and when the visitor picks a choice, it opens a web page in another part of the screen. For instance, the FreeServers help pages use frames: there is a menu on the left hand side of the screen that opens the help information on the right side of the screen.

Q: How do I make a website out of frames?

The use of frames to create web pages can be very complicated. If you are planning to use frames, it may be a good idea to use web page creation software, such as Macromedia's Dreamweaver or Microsoft FrontPage, that allows the creation of frames. However, if you wish to create frames in HTML, here are the essentials.

First, you need to create the HTML file that will make the frames. Immediately after the </head> tag in the document, you need to insert a <FRAMESET> tag like this:

<FRAMESET COLS="25%,75%">


That would create two frames--one 25% the width of the screen, and one 75%. If you just use numbers instead of percentages, the browser will split the screen proportionally, unless one of the numbers is replaced by *, like this:

<FRAMESET COLS="50,250,*">


In this case, there would be three frames--one 50 pixels wide, one 250 pixels wide, and one filling the rest of the space.

If you want the screen split horizontally, you would use ROWS instead of COLS in the <FRAMESET> tag.

If you want to split the screen both ways, you can use one <FRAMESET> tag to create rows and another to create columns.

Once you have your <FRAMESET> tag, you need to establish what the source will be for each frame. This is done with the <FRAME> tag.

<FRAME SRC="child1.html" NAME="leftside">


The SRC attribute is the URL of the page that will be loaded into the frame. The NAME attribute allows hyperlinks to load into a particular frame.

Putting this all together, your main frames page could look something like this:

<FRAMESET COLS="150,*">
<FRAME SRC="leftcolumn.html" NAME="leftcolumn">
<FRAMESET ROWS="50%,50%">
<FRAME SRC="topright.html" NAME="topright">
<FRAME SRC="bottomright.html" NAME="bottomright">
</frameset>
</frameset>


This example creates a left column (named "leftcolumn") that is 150 pixels wide and a right column that takes up the rest of the screen. The right column is divided into two equal frames, named "topright" and "bottomright". Click here to see the results.

In order to get a link to open in a particular frame, you must include a TARGET attribute in the <A > tag with the hyperlink. Example:

<A HREF="newleft.html" TARGET="leftcolumn">Click Here</a>


There are a few special targets besides the names you established in the <FRAME> tags:

"_top" loads the target page in the entire current window, not just in a frame.
"_parent" loads the page into the space occupied by the document with the <FRAMESET> tags.
"_self" loads the page into the frame that has the hyperlink.
"_blank" loads the page into a new browser window.
That's it--your basic introduction to building pages with frames.