BruJon's Webtips archief

last update: fri 15 jan 2002

Hier volgt binnenkort nog een inhoudsopgave en zoeker.

Includes

Reducing the size of your pages not only decreases load time, but it makes code reading and editing much easier.
HTML (IIS server-side) Includes:
<!--#include file="<file1>.asp"-->
HTML code for the page file
<!--#include file="<file2>.asp"-->

CSS Stylesheet Includes:
Start a new file in your favorite editor, and save it as <name>.css.
Now that you have a stylesheet, you INCLUDE it on your pages, like this:<LINK HREF="name.css" type="text/css" REL="stylesheet">

Javascript Includes:
Take all of your Javascript code and place it in a NEW file you will create. It MUST have the extension .js.
Now where you want that file to show up, add the following: <script src="myfile.js" language="javascript" type="text/javascript"></script>

Inline Frames

Inline frames, also known as IFrames, are created with the <IFRAME> tag, which is supported by Explorer 3.2 and up, as well as Netscape 4.0 or better. Inline frames differ from the regular <Frame> tag, as we simply embed them right into an HTML page. No frameset or index pages are required.

Here is an example of how to use a simple IFRAME:
<IFRAME SRC="sample.html"></IFRAME>

All we will do place the IFrame into a page, bearing the source of the actual file. This method is handy if you want to give people remote files to include on their site, sourcing a file to yours.

So in our example, an HTML page carrying our IFRAME might look like this:

<HTML>
<BODY>
Our page ... text, etc ... and now, here comes the IFRAME!
<IFRAME SRC="sample.html"></IFRAME>
</BODY>
</HTML>

The IFRAME Tag does carry some specific attributes to help you control the display. Here is a quick, but limited reference:

ALIGN Offset to other elements, much like the Image Tag.

BORDER The default is 0 (pixels)

HEIGHT / WIDTH (pixels or %)

HSPACE / VSPACE As with Images, this attribute specifies a pixel size for horizontal or vertical margins around the IFRAME (external margin)

MARGINHEIGHT / MARGINWIDTH Internal margin in pixels

SCROLLING If set to "AUTO," the browser determines whether scrollbars are necessary; otherwise, specify either "YES" or "NO"

Margins Explained

Ever noticed how some sites sit flush to the top or left of your browser? We control this with page margins, and they are very simple to use. Margins are controlled in the <BODY> tag. Note that (as usual) there are differences in how IE and Netscape handle these tags. Your best bet is to incorporate ALL tags so that both browsers will show similar results.

Here's how it works:

<BODY TOPMARGIN="0" LEFTMARGIN="0">

Simple, right? Here's the additional code for Navigator users:
MARGINHEIGHT and MARGINWIDTH, like so:
<BODY MARGINHEIGHT="0" MARGINWIDTH="0">

To combine both browser elements, simply put them together:
<BODY TOPMARGIN="0" LEFTMARGIN="0" MARGINHEIGHT="0" MARGINWIDTH="0">

By the way ... there are no BOTTOMMARGIN or RIGHTMARGIN attributes :)