11. Creating Frames

Introduction

When it comes to Web design, frames have been around for quite a long time. In that time they have constantly fallen in and out of favor. Some Web designers can’t live without them, and some designers would never in a million years use them. However, whether you love them or dislike them, frames are here to stay... at least for today.

Frames are an interesting way to design a Web document. Think of a window with separate panes of glass. Now, think of that window as a Web page, and each one of those separate panes of glass as a separate HTML document, and you’ve got a pretty good visualization of a Web page containing frames. For example, you can have a two-frame page with one frame containing the navigation for the site, and the other frame the contents. When you click on a link in the navigation frame, the content frame displays another HTML document, and the frame containing the navigation never changes.

There’s a certain beauty in being able to change one area of a Web page and leave another area static. Good Web designers with a good sense of how to utilize frame technology can create some pretty awesome Web sites.

A framed document is composed of a frameset page (called so because it uses the <frameset> tag), and two or more HTML documents. When the frameset page loads on the visitor’s browser, it calls and loads the HTML documents, and displays the page.

Dreamweaver makes the coding and managing of frames easy with a point-and-click interface. You control the commands for modifying the properties of the overall frames, and each individual frame. This chapter will give you the essentials of creating frames, and information for inserting and modifying frames and framesets, as well as how you might apply them in your own Web designs.

Introducing Frames

Frame documents use a <frameset>... </frameset> tag set to create documents in multiple views. The multiple view nature of frame documents lets designers keep certain information visible, while other windows within the frame are scrolled or replaced. For example, within the same window, one frame might display a static banner, a second a navigation menu, and a third the main document that can be scrolled through or replaced by navigating in the second frame.

If you were to design a Frame page directly in HTML, it might look something like this:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"

  "http://www.w3.org/TR/html4/frameset.dtd">

<html>

<head>

<title>A frameset </title>

</head>

<frameset cols="20%, 80%">

 < frameset rows="100, 200">

    <frame src="doc1.html">

    < frame src="doc2.gif">

 </ frameset >

 < frame src="doc3.html">

</ frameset >

</html>


Image

Frames divide a browser window into two or more document windows, each displaying a different document, or a different part of the same document. Frames in an HTML document cause a web page to look as if it’s divided into multiple, scrollable regions. Each separate frame has a distinct name, which the frameset uses to load specific HTML documents.

Frames in HTML documents are created and controlled through three distinct element types: FRAMESET, FRAME and NOFRAMES.

The Frameset Element

A frameset divides the browser window into two or more rectangular regions. For example the following HTML code describes a basic frameset:

<frameset cols="30%,30%,40%">


This code describes a frame set divided vertically into three regions, and each region is a percentage of the width of the browser window (30%, 30%, and 40%). Since the rows attribute was not used, this frameset does not include rows.

The Frame Element

The Frame element defines a single frame in a frameset, and can include up to seven attributes: src, name, frameborder, marginwidth, marginheight, scrolling, and noresize. Since the frame tag is not defined as a container, it has no matching end tag. The following is an example of a frame element:

<html>

<frameset rows="20%,80%">

        <frame src="http://www.power.com/">

        <frameset cols="60%,40%">

                <frame src="http://www.andy.com/">

                <frame src="http://www.steve.com/">

         </frameset>

</frameset>

</html>


The <noframes> Tag

The noframe element contains content that should only be rendered when frames are not displayed. Noframe is typically used in a Frameset document to provide alternate content for browsers that do not support frames or have frames disabled. The following is an example of the noframes tag.

<noframes>

    <p>The Frameset contains:

    <ul>

      <li><A href="contents_of_frame1.html">content_1</A>

      <li><img src="image.gif">

      <li><A href="noframes.html">Some other neat contents</A>

    </ul>

</noframes>


Creating a New Frame

Most of the framesets on the Web today use two or three frames. For example, a common setup is to have one narrow frame spanning the top of the page to hold a banner and some site navigation; a lower-left frame to hold a table of contents or additional navigation; and a large lower-right frame to hold the content of the site. Or it can be as simple as two frames: one small frame for navigation, and a larger frame for the main body of information. You can create a new document with frames using samples from the New Document dialog box or add frames to an existing document using the Frames button or dragging a frame border. After you create a frameset, you can enter text, images, and other content in each of the frames, as you would for any normal HTML document, or you can instruct the frame to load a previously created HTML document.

Create a Frameset from a Sample

Create a Frameset from a Sample Click the File menu, and then click New.

Create a Frameset from a Sample Click the Page from Sample category.

Create a Frameset from a Sample

Create a Frameset from a Sample Click Frameset in Sample Folder options.

Create a Frameset from a Sample Select a Sample Page.

Timesaver

Click the Get more content link to add more templates to the New Document dialog box.

Timesaver Click Create.

The Frame Tag Accessibility Attributes dialog box opens.

Timesaver Click the Frame popup, select a frame, and then enter a name (one word, start with a letter, and case-sensitive) for each frame in the document.

Timesaver Click OK.

Did You Know?

You can use a grid to help layout a frame document. Click the View menu, point to Grid, and then click Show Grid to show the grid.

Insert a Frameset

Insert a Frameset Create a new HTML document, or open an existing one.

Insert a Frameset

Insert a Frameset Click the Layout tab on the Insert bar.

Insert a Frameset Click the Frames button, and select a frameset from the available options (in this example, Left Frame).

The Frame Tag Accessibility Attributes dialog box opens.

Insert a Frameset Click the Frame popup, select a frame, and then enter a name (one word, start with a letter, and case-sensitive) for each frame in the document.

Insert a Frameset Click OK.

Create a Frameset with Click and Drag

Create a Frameset with Click and Drag Create a new HTML document, or open an existing one.

Create a Frameset with Click and Drag

Create a Frameset with Click and Drag Click the View menu, point to Visual Aids, and then click Frame Borders.

Dreamweaver creates a heavy outline around the edges of the document window.

Create a Frameset with Click and Drag Position the cursor over one of the borders until it turns into a double-headed arrow, and then drag to create a new frame.

Create a Frameset with Click and Drag Continue dragging from the vertical or horizontal border until you have the frames you want.

Timesaver

Hold down Alt (Win) or Option (Mac) while you drag an existing frame border to create a new frame instead instead of moving it.

Opening a Web Page in a Frame

After you create a frame, you can specify the content you want to appear in it. You can insert new content in a frame the same way you insert other content, such as text or images, into a Web page or open an existing HTML Web page in a frame. If you consistently use the same Web page in a frame, you can make the page the default document when the frameset appears in a browser.

Open an Existing Web Page in a Frame

Open an Existing Web Page in a Frame Open the Web page with frames you want to modify, and then click to place the insertion point in the frame where you want to insert a Web page.

Open an Existing Web Page in a Frame

Open an Existing Web Page in a Frame Click the File menu, and then click Open in Frame.

Timesaver

Press Ctrl+Shift+ O (Win) or Timesaver+Shift+O (Mac).

Timesaver Navigate to the drive and folder location where you want to open the Web page.

Timesaver

Timesaver Click the Files of Type list arrow (Win) or popup (Mac), and then select the type of file you want to open.

Timesaver Select the page you want to open from the page list in the working folder, or type the URL of the page you want.

Timesaver Click OK.

Providing Information for No Frame Support

If a browser doesn’t support frames, you can provide information to visitors instead of leaving them hanging with nowhere to go. When a browser that doesn’t support frames loads the frameset document, the browser displays the information you provide in a noframes tag. The Edit NoFrames Content command makes it easy to add the information you want without inserting HTML code. However, if you are comfortable entering code, you can certainly enter the information in the noframes tag.

Provide Information for Browsers with No Frame Support

Provide Information for Browsers with No Frame Support Open the Web page with the frameset you want to modify.

Provide Information for Browsers with No Frame Support

Provide Information for Browsers with No Frame Support Click the Modify menu, point to Frameset, and then click Edit NoFrames Content.

The Design view clears, and the words “NoFrames Content” appears at the top of the Document window.

Provide Information for Browsers with No Frame Support Type the information you want visitors to see when their browsers don’t support frames.

You can also click the Window menu, click Code Inspector, and then type the HTML code for the text you want to display in the body tags inside the noframes tags.

Provide Information for Browsers with No Frame Support Click the Modify menu, point to Frameset, and then click Edit NoFrames Content.

The normal view of the frameset document appears.

Selecting Frames and Framesets

Before you can make any changes to a frame or frameset, you need to select it first. You can select a frame or frameset directly in the Document window, by using keyboard shortcuts, or by using the Frames panel. The Frames panel shows you the frames within a frameset. A frameset appears with a thick border and each frame appears with a thin gray link along with a frame name, which makes them easier to view and select. When a frame is selected in the Document window, the frame border appears outlined with a dotted line. When a frameset is selected, all the frame borders appear with a light dotted line.

Select Frames and Framesets

Frames Panel. Click the Window menu, click Frames to display the Frames panel, and then use any of the following:

Frame. Click the frame.

Frameset. Click the border around the frameset.

Frames Panel.

Document Window. Display the Web page with frames in Design view, and then use any of the following:

Frame. Alt-click (Win) or Option-Shift-click in a frame.

Frameset. Click one of the frameset’s internal borders.

Different Frames or Framesets. Use the Arrow keys to select frames or framesets.

Next or Previous. Press Alt+Left Arrow or Alt+Right Arrow (Win) or Different Frames or Framesets. +Left Arrow or Different Frames or Framesets. +Right Arrow (Mac).

Parent Frameset. Press Alt+Up Arrow (Win) or Different Frames or Framesets. +Up Arrow (Mac).

First Child Frame or Current Frameset. Press Alt+Down Arrow (Win) or Different Frames or Framesets. +Down Arrow (Mac).

Adding Frameset Information

A frameset document consists of separate frames. As a matter of fact, each one of the frames is simply a small HTML document. Frames can contain any normal HTML information, including text, tables, images, multimedia, objects, and even nested frames. When you create a Frameset document, you’re actually creating several separate documents. You have the frameset HTML document, and a separate HTML document for each of the frames. For example, if you create a frameset with two frames, you’re actually saving three separate documents: one for the frameset and one for each of the frames within the document.

Add Frameset Information

Add Frameset Information Create a new Web page with a frameset, or open an existing one.

Add Frameset Information

Add Frameset Information Click in a frame where you want to add some information.

Add Frameset Information Add or insert the text and graphics you want until the frames are filled with the specified information (in this example, a graphic).

Saving a Frameset

When you create a frameset with two frames, you’re actually saving three separate documents: one for the frameset and one for each of the frames within the document. You can save the frameset and each document in a frame individually or you can save them all at once. Before you can preview a frameset in a browser, you need to save the frameset and all frame document first. Once the frame documents have been saved, they can be opened independently of the frameset and modified just like regular HTML documents; any changes to the page will be reflected when it’s reopened in the frameset. When you reopen the frameset document, it locates and reopens the associated pages and place them into the proper frames.

Save a Frameset as a New File

Save a Frameset as a New File Select the frameset you want to save.

Save a Frameset as a New File Click the File menu, and then click Save Frameset As.

Timesaver

Press Ctrl+Shift+S (Win) or Timesaver +Shift+S (Mac).

Note

Dreamweaver prompts you to save your document in the active site folder (strongly recommended).

Note Navigate to the location where you want to save the frame document.

Note

Note Enter a name for the frameset document.

Note Click Save.

Did You Know?

You can save the frameset and all frame documents at the same time. Click the File menu, and then click Save All.

Save a Frame as a New File

Save a Frame as a New File Click in the frame you want to save.

Save a Frame as a New File Click the File menu, and then select Save Frame As.

Save a Frame as a New File

Timesaver

Press Ctrl+Shift+S (Win) or Timesaver+Shift+S.

Note

Dreamweaver prompts you to save your document in the active site folder (strongly recommended).

Note Navigate to the location where you want to save the frame document.

Note

Note Enter a name for the new frame document.

Note Click Save.

Did You Know?

You can quickly save a frameset or frame previously saved as a file. Select the frameset or frame you want to save, click the File menu, and then click Save Frameset or Save Frame. You can also press Ctrl+S (Win) or You can quickly save a frameset or frame previously saved as a file.+S (Mac).

Modifying Frames

Once a frameset is created, it’s possible, and quite likely, that you will want to modify the dimensions of the frames to fit a specific design need. Remember that the frame within a frameset functions as a container for a specific HTML document. If this document is not set up correctly, you may experience problems with unwanted reformatting of the information when it displays in the browser window. Therefore, it’s important to modify the frames to give your document the best look and feel for the visitor.

Resize a Frame

Resize a Frame Open the Web page with the frameset you want to modify.

Resize a Frame

Resize a Frame To display visual frame borders, click the View menu, point to Visual Aids, and then click Frame Borders.

Resize a Frame Mouse over one of the borders until your cursor turns into a double-headed arrow.

Resize a Frame Drag a frame border to modify its position and size.

Did You Know?

You can edit accessibility values for a frame. Click the View menu, and then click Code or Code and Design, click the Window menu, click Frames to display the Frames panel, click the place the insertion point in a frame, right-click (Win) or You can edit accessibility values for a frame.-click (Mac) in the code, and then click Edit Tag, make the changes you want, and then click OK.

Add a Frame

Add a Frame Open the Web page with the frameset you want to modify.

Add a Frame

Add a Frame To display visual frame borders, click the View menu, point to Visual Aids, and then click Frame Borders.

Add a Frame Holding down Alt (Win) or Option (Mac) and drag one of the borders.

Add a Frame Release you mouse to add the new frame to the document.

Delete a Frame

Delete a Frame Open the Web page with the frame you want to modify.

Delete a Frame

Delete a Frame To display visual frame borders, click the View menu, point to Visual Aids, and then click Frame Borders.

Delete a Frame Click the frame border and drag it into the border of the enclosing or parent frame.

Note

If no parent frame is present, drag the frame border to the edge of the page.

Note Release the mouse and the frame is removed.

If the deleted frame contains unsaved content, Dreamweaver asks if you want to save the file before closing it.

Changing Frame Properties

As mentioned before, frameset documents are simply individual HTML documents, with all the rights and privileges of any other HTML document. They can have any content; including tables and layers, and they have the same properties of any other HTML document, such as: backgrounds, margins, headings, etc. You can change the properties of a HTML document destined to be displayed within a frameset in one of two ways. The first is to open the document directly in Dreamweaver, make any changes, and then save the document. When it’s opened within the frameset, the changes to the properties will be displayed as ordered by you. The second way is to change their properties while viewing the document within the frameset (recommended). Since the procedure is basically the same, we’ll examine the changing of page properties while viewing the document in the frameset.

Change Page Properties for a Frame Document

Change Page Properties for a Frame Document Open the Web page with the frameset you want to modify.

Change Page Properties for a Frame Document

Change Page Properties for a Frame Document Right-click (Win) or Control-click (Mac) the HTML frame document that you want to modify, and then click Page Properties.

Change Page Properties for a Frame Document Select from the following Page Properties options:

Appearance (CSS) or Appearance (HTML). Select to change the overall appearance of the page; including background, text and margins.

Links (CSS). Select to change linking information; link colors and fonts and underlining.

Headings (CSS). Select to modify the heading font, color and size.

Title/Encoding. Select to modify the title and encoding of the page (this information is used by browsers to help properly display the page).

Tracing Image. Select to add or modify a tracing image.

Tracing Image.

Tracing Image. Click OK.

Change Frame Properties

Change Frame Properties Open the Web page with the frameset you want to modify.

Change Frame Properties

Change Frame Properties Select the frame you want to modify in the Frames panel or Shift-Alt-click (Win) or Shift-Option-click (Mac) the frame in Design view.

You can also click a frame in the Frames panel.

Change Frame Properties Open the Properties panel.

Change Frame Properties Select from the following Frame Properties options:

Frame Name. Enter the name you want used by a link’s target attribute or by a script to refer to a frame. A frame name must start with a letter and it’s case-sensitive.

Scr. Specifies the source document to display in the frame.

Scroll. Click to select a scroll display option: No (hide), Yes (show), Auto (only when needed), or Default (dictated by browser).

No Resize. Select to prevent visitors from dragging frame borders in a browser.

Borders. Click to select a border display option: No (hide), Yes (show), or Default (dictated by browser).

Border Color. Click to select a color for the frame borders.

Margin Width. Specify the width in pixels of the left and right margins.

Margin Height. Specify the height in pixels of the top and bottom margins.

Changing Frameset Properties

In addition to setting properties for the individual frames and frame documents, you can also set properties for the frameset. After you select the frameset, you can use the Properties panel to view and set frameset properties. The available options allow you to change border and frame sizes. You can show or hide borders, change border width and color, and set the frame sizes for rows and columns of the frameset. The RowCol Selection area in the Properties panel provides tabs on the left side and top to select a frame. After you select a frame, you can set the frame height and width you want in the Value box and how much space the browser allocates to each frame in the Units popup. You can set these options for each frame you select. In the Document window, you can also change the frameset title.

Modify Frameset Border Properties

Modify Frameset Border Properties Open the Web page with the frameset you want to modify.

Modify Frameset Border Properties

Modify Frameset Border Properties Click the View menu, point to Visual Aids, and then click Frame Borders to display visual borders.

Modify Frameset Border Properties Open the Properties panel, and then expand it.

Modify Frameset Border Properties Click one of the frame borders to select the frameset.

Modify Frameset Border Properties Modify the frames using the options in the Properties panel:

Border Window. Click to select the specific frame (row/column) you want to modify.

Borders. Click to select border displays option you want: No (hide border), Yes (show border), or Default (dictated by browser).

Border Width. Enter a value (in pixels) for the width of the borders.

Border Color. Click to select a color for the borders.

Modify Frameset Size Properties

Modify Frameset Size Properties Open the Web page with the frameset you want to modify.

Modify Frameset Size Properties

Modify Frameset Size Properties Click the View menu, point to Visual Aids, and then click Frame Borders to display visual borders.

Modify Frameset Size Properties Open the Properties panel, and then expand it.

Modify Frameset Size Properties Click one of the frame borders to select the frameset.

Modify Frameset Size Properties Click a tab on the left side or top of the Row/Col Selection area to select the frame you want to set the Value and Units below.

Modify Frameset Size Properties Enter a value to determine the height or width of the frame.

Modify Frameset Size Properties Click the Units popup, and then select the measurement units for the Row/Column value you want:

Pixels. Sets the size of the column or row to an absolute value. Typically used with a left-side frame.

Percent. Sets the column or row to be a percentage the total width or height of its frameset.

Relative. Allocates the available space after Pixels to the selected column or row. Typically used with a right-side frame.

Did You Know?

You can set the title for a frameset page. Open the page, select the frameset in Design view, and then type a name for the frameset in the Title box on the Document toolbar. When a visitor opens the frameset page in a browser, the title appears in the browser’s title bar.

Targeting Links

Thus far, this chapter has dealt with the creation of frameset documents, and the adding and saving of Web data on the individual HTML pages. However, the real power of frames is their ability to load new pages into selected frames, based on an available link. For example, you could be a photographer that wants people to see your images (and hopefully buy them). You create a two-framed Web document that has links to your images on the left. When you click on a link, the frame on the right changes to display a large example of your photographic talent. To use a link in one frame to open a document in another frame, you need to set a target for the link. The target instructs the browser into which frame to place the new document. When a visitor clicks the link, the specified content opens in the specified frame.

Create a Targeted Link

Create a Targeted Link Open the Web page with the frameset you want to create a targeted link.

Create a Targeted Link

Create a Targeted Link Select the object or text to be converted into a targeted link.

Create a Targeted Link Open the Properties panel.

Create a Targeted Link Create the link to the new document using one of the following methods:

Click the folder icon, and then select the link file.

Drag the Point to File icon to the Files panel to select the link file.

Create a Targeted Link Click the Target button, and then select the target frame name (at the bottom of the list), or select from the following options.

_blank. Opens the linked document in a new browser window, leaving the current window untouched.

_parent. Opens the linked document in the parent frameset of the frame the link appears in, replacing the entire frameset.

_self. Opens the link in the current frame, replacing the content in that frame.

_self.

_top. Opens the linked document in the current browser window, replacing all frames.

Important

Frame names appear when you’re editing the document within a frameset. When you edit a document in its own window, frame names do not appear in the Target popup menu. If you’re editing a document outside of the frameset, you can type the target frame’s name in the Target text box.

Important Click the File menu, point to Preview In Browser, and then select a browser of your choice to test the document.

Creating Quick and Easy Frame Links

This method is great for those Web sites that contain a lot of links to a lot of boring text documents. To make this process work, the name of the HTML document should be the name you want for the link; for example, formatting.html, or frame_help.html. The documents are the standard HTML type: graphics, text... the whole nine yards. You just want to create a simple, almost file folder kind of page, where a visitor clicks on a link, and it loads the appropriate page in another frame.

Create Quick and Easy Frame Links

Create Quick and Easy Frame Links Create a frameset document with two frames: one for the links, and one for the documents. Name them links and documents.

Create Quick and Easy Frame Links

Create Quick and Easy Frame Links Open the Files panel and display all the HTML documents that you want to use as links.

Create Quick and Easy Frame Links Drag and drop one of the files from the Files panel into the links frame (it appears as an underlined link).

Note

If the original name of the HTML document is document_1.html, the linked text will be document_1, without the HTML extension.

Note Select the linked text.

Note Click the Target popup in the Properties panel, and then select the content frame name as the target for this file.

Note Repeat steps 3-5 until you have all your documents displayed as links.

Note Click the File menu, point to Preview In Browser, and then select a browser of your choice to test the document.

Note

If you don’t like the file name as the link name, you can always select the file name in the links frames and change it. The change in name will not affect the link to the file.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset