Sams Teach Yourself Web Publishing with HTML and CSS in One Hour a Day (5th Edition)

If your head is hurting after today, you're probably not alone. Although the basic concepts behind the use of frames are relatively straightforward, their implementation is somewhat harder to come to grips with. As a result, the best way to learn about frames is by experimenting with them.

Today, you learned how to link a document to a new or existing window. In addition, you learned how to create framesets and link them together by using the tags listed in Table 14.5.

Table 14.5. New Tags Discussed in Lesson 14

Tag

Attribute

Description

<base target="window">

 

Sets the global link window for a document.

<frameset>

 

Defines the basic structure of a frameset.

 

cols

Defines the number of frame columns and their width in a frameset.

 

rows

Defines the number of frame rows and their height in a frameset.

 

frameborder

Indicates whether the frameset displays borders between frames.

 

bordercolor

Defines the color of borders in a frameset.

<frame>

 

Defines the contents of a frame within a frameset.

 

src

Indicates the URL of the document to be displayed inside the frame.

 

marginwidth

Indicates the size in pixels of the margin on each side of a frame.

 

marginheight

Indicates the size in pixels of the margin above and below the contents of a frame.

 

scrolling

Enables or disables the display of scrollbars for a frame. Values are yes, no, and auto.

 

noresize

Prevents the users from resizing frames.

 

frameborder

Indicates whether the frameset displays borders between frames.

 

bordercolor

Defines the color of borders in a frameset.

 

longdesc

Specifies a URL that provides a longer description of the contents of the frameset. Used with nonvisual browsers.

 

name

Assigns a name to the frame for targeting purposes.

<iframe>

 

Defines an inline or floating frame.

 

src

Indicates the URL of the document to be displayed in the frame.

 

name

Indicates the name of the frame for the purpose of linking and targeting.

 

width

Indicates the width of the frame in pixels.

 

height

Indicates the height of the frame in pixels.

 

marginwidth

Indicates the width of the margin in pixels.

 

marginheight

Indicates the height of the margin in pixels.

 

scrolling

Enables or disables the display of scrollbars in the frame. Values are yes, no, and auto.

 

frameborder

Enables or disables the display of a border around the frame. Values are 1 and 0.

 

vspace

Indicates the height of the margin in pixels.

 

hspace

Indicates the width of the margin in pixels.

 

align

Specifies the alignment of the frame relative to the current line of text. Values are left, right, middle, top, and bottom (also absbottom, absmiddle, texttop, and baseline in Internet Explorer).

<noframes>

 

Defines text to be displayed by web browsers that don't support the use of frames.

The Downside of Frames

In this lesson I've mentioned a few drawbacks of frames here and there. I wanted to talk about them one more time now that the discussion of frames is coming to a close. The problem with frames is that they change the concept of a web page. Unfortunately, many mechanisms that users are familiar with rely on the original concept. So when it comes to navigation, bookmarking pages, or using the browser's Back button, frames can cause confusion. There are also issues when it comes to printing, and frames can cause problems on devices with small screens, like mobile phones.

The point here isn't to say that frames should never be used, but rather that you should think about what you're trying to accomplish and decide whether another approach wouldn't work better. CSS adds enough layout options that frames can often be avoided, especially floating frames.

Категории