Creating Web Pages Using Frames - PowerPoint PPT Presentation

1 / 39
About This Presentation
Title:

Creating Web Pages Using Frames

Description:

... to display information from several pages at the same time. ... To create a frame layout, you will use the rows and cols attributes of the frameset tag. ... – PowerPoint PPT presentation

Number of Views:43
Avg rating:3.0/5.0
Slides: 40
Provided by: somC2
Category:

less

Transcript and Presenter's Notes

Title: Creating Web Pages Using Frames


1
Creating Web Pages Using Frames
2
Tutorial Objectives
  • Create frames for a Web site
  • Control the appearance and placement of frames
  • Control the behavior of hyperlinks on a Web page
    with frames
  • Use reserved target names to specify a target for
    a hypertext link
  • Create a Web page that is viewable by browsers
    that support frames and by those that do not
  • Modify the appearance of your frame borders
  • Create and implement floating frames

3
Considerations for a Web Site
  • A Web site grows in size and complexity, each
    page is dedicated to a particular topic or group
    of topics.
  • one page might contain a list of hypertext links
  • one page might display contact information for
    the company or organization
  • one page might describe the business philosophy
  • As more pages are added to a Web site, a designer
    may what to display information from several
    pages at the same time.
  • Such considerations contributed to the creation
    of frames.

4
Advantages to Using Frames
  • Frames can give more flexibility in designing
    your Web presentation.
  • You can place information in different Web pages,
    removing redundancy.
  • Frames can make your site easier to manage.
  • Frames allows you to update only a few files
    rather than the whole.
  • Web designers advocate creating both framed and
    non-framed versions for a Web site and giving
    users the option of which one to use.

5
Disadvantages to Using Frames
  • The browser has to load multiple HTML files
    before a user can view the contents of the site
    increasing the waiting time for potential
    customers.
  • Some older browsers cannot display frames.
  • Some users simply do not like using frames.
  • Some web authors feel that frames are too
    constricting, limiting flexibility in designing
    the layout of a Web page.
  • There is concern that frames can use up valuable
    screen space.
  • The source code is removed from the user.

6
Introducing Frames
  • A frame is a section of the browser window
    capable of displaying the contents of an entire
    Web page. For example
  • the frame on the left may display the contents of
    a Web page containing a list of hyperlinks
  • the frame on the right may display a Web page
    with product information

7
Planning Your Frames
  • Before you start creating your frames, it is a
    good idea to plan their appearance and how they
    are to be used. There are several issues to
    consider
  • What information will be displayed in each of the
    frames?
  • How do you want the frames placed on the Web
    page?
  • What is the size of each frame?
  • Which frames will be static, that is, always
    showing the same content?

8
Planning Your Frames Continued
  • Which frames will change in response to
    hyperlinks being clicked?
  • What Web pages will users first see when they
    access the site?
  • Should users be permitted to resize the frames to
    suit the needs?

9
Creating a Frame Layout
  • The ltframesetgt tag is used to store the
    definitions of the various frames in the file.
    These definitions will typically
  • include the size and location of the frame
  • include the Web pages the frames display
  • The ltframesetgt code does not include an opening
    and closing ltbodygt tag.
  • the reason for this is that this HTML file
    displays the contents of other Web pages
    technically, it is not a Web page

10
Specifying Frame Size and Orientation
  • To create a frame layout, you will use the rows
    and cols attributes of the ltframesetgt tag.
  • the rows attribute creates a row of frames
  • the cols attribute creates a column of frames
  • A frameset is defined by rows or columns, but not
    both.
  • You must choose to layout your frames in either
    rows or columns.

11
The Frame Syntax
  • The syntax for creating a row or column frame
    layout is
  • ltframeset rowsrow height 1, row height 2, row
    height 3, . . .gt
  • row height is the height of each row
  • or
  • ltframeset colscolumn width 1, column width 2,
    column width 3, . . .gt
  • column width is the width of each column

12
Row and Column Sizes
  • Row and column sizes can be specified in three
    ways
  • in pixels
  • as a percentage of the total size of the frameset
  • by an asterisk ()

13
Defining Rows and Columns Using an Asterisk ()
  • The asterisk instructs the browser to allocate
    any unclaimed space in the frameset to the
    particular row or column.
  • for example, the tag ltframeset rows160,gt
    creates two rows of frames.
  • Specify at least one of the rows or columns of
    your ltframesetgt tag with an asterisk to ensure
    that the frames fill up the screen.
  • You can use multiple asterisks.
  • The browser divides the remaining display space
    equally among the frames with the asterisks.
  • for example, the tag ltframeset rows,,gt
    creates three rows of frames with equal heights.

14
Specifying a Frame Source
  • To specify a source for a frame, use the ltframegt
    tag with the syntax ltframe srcURLgt
  • The URL is the filename and location of the page
    that you want to load.
  • You must insert the ltframegt tag between the
    opening and closing ltframesetgt tags.

15
Nesting ltframesetgt Tag
  • Remember that a frameset is defined by rows or
    columns, but not both.
  • To create frames using both rows and columns, one
    frameset must be nested inside another.
  • The interpretation of the rows and cols
    attributes changes slightly.
  • for example, a row height of 25 does not mean
    25 of the display area, but rather 25 of the
    height of the frame into which that row has been
    inserted (or nested)

16
Controlling the Appearanceof Your Frames
  • You can control three attributes of a frame
  • scroll bars
  • the size of the margin between the source
    document and the frame border
  • whether or not the user is allowed to change the
    size of the frame

17
Controlling the Appearanceof Scroll Bars
  • By default, scroll bars are displayed when the
    content of the source page cannot fit within the
    frame.
  • You can override the default setting using the
    scrolling attribute.
  • The scrolling syntax is ltframe srcURL
    scrollingscrollinggt
  • scrolling can either be yes (to always display
    scroll bars) or no (to never display scroll
    bars)
  • If you dont specify a setting for the scrolling
    attribute, the browser displays scroll bars when
    necessary.

18
Controlling Frame Margins
  • The following should be consider for frame
    margins
  • the browser determines the amount of space
    between the content of the page and the frame
    border
  • occasionally, the browser sets the margin between
    the border and the content too large
  • the margin should be big enough to keep the
    sources text or images from running into the
    frames borders
  • the margin should not take up too much space,
    because you typically want to display as much of
    the source as possible

19
Specifying Margins Syntax
  • The syntax for specifying margins for a frame is
    ltframe srcURL marginheightvalue
    marginwidthvaluegt
  • marginheight is the amount of space, in pixels,
    above and below the content of the page in the
    frame
  • marginwidth is the amount of space to the left
    and right of the page
  • If you specify only one, the browser assumes that
    you want to use the same value for both.
  • Setting margin values is a process of trial and
    error as you determine what combination of margin
    sizes looks best.

20
Controlling Frame Resizing
  • By default, users can resize frame borders in the
    browser by simply dragging a frame border.
  • Some Web designers prefer to freeze, or lock,
    frames, so that users cannot resize them.
  • this ensures that the Web site displays as the
    designer intended
  • The syntax for controlling frame resizing is
    ltframe srcURL noresizegt
  • The noresize attribute is included within the
    ltframegt tag to prevent users from modifying the
    size of the frame.

21
Working with Frames and Hypertext Links
  • By default, clicking a hyperlink within a frame
    opens the linked file inside the same frame.
  • You can display hyperlinks in many ways
  • in a different frame
  • in a new window
  • in the entire window
  • When you want to control the behavior of
    hyperlinks in a framed page, there are two
    required steps
  • give each frame on the page a name
  • point each hyperlink to one of the named frames

22
Assigning a Name to a Frame
  • To assign a name to a frame, add the name
    attribute to the frame tag.
  • The syntax for this attribute is ltframe
    srcURL nameframe_namegt
  • frame_name is any single word you assign to the
    frame
  • case is important in assigning names
    information is considered a different name than
    INFORMATION

23
Specifying a Link Target
  • You can use the target attribute to open a page
    in a specific frame.
  • The syntax for this is lta hrefURL
    targetframe_namegt
  • frame_name is the name youve assigned to a frame
    on your Web page
  • When a page contains dozens of hyperlinks that
    should all open in the same frame, HTML provides
    a way to specify a target frame for all the
    hyperlinks within a single page.

24
Using the ltbasegt Tag
  • Use the ltbasegt tag to specify the default target
    for hyperlinks in a frame layout.
  • Appears in the HEAD section of the HTML file.
  • Used to specify global options for the page.
  • One of the attributes of the ltbasegt tag is the
    target attribute, which identifies a default
    target for all of the hyperlinks in a page.
  • The syntax for this attribute is ltbase
    targetframe_namegt
  • frame_name is the name of the target frame

25
Using the ltbasegt Tag Continued
  • The ltbasegt tag is useful when your page contains
    a lot of hypertext links that all point to the
    same target.
  • Rather than adding the target attribute to each
    ltagt tag, you can enter the information once with
    the ltbasegt tag.
  • You can still use the ltbasegt tag even if your
    file contains links that point to a different
    target than the one specified in the ltbasegt tag.
  • The target in the ltagt tag overrides any target
    specified in the ltbasegt tag.

26
Using Reserved Target Names
  • Reserved target names are special names that can
    be used in place of a frame name as the target.
  • They are useful in situations
  • where the name of the frame is unavailable
  • when you want the page to appear in a new window
  • when you want the page to replace the current
    browser window
  • All reserved target names begin with the
    underscore character ( _ ) to distinguish them
    from other target names.
  • Reserved target names are case-sensitive, they
    must be entered in lowercase.

27
Reserved Target Names
28
Using the ltnoframesgt Tag
  • Use the ltnoframesgt tag to allow your Web site to
    be viewable using browsers that do or do not
    support frames.
  • When a browser that supports frames processes
    this code, it ignores everything within the
    ltnoframesgt tags and concentrates solely on the
    code within the ltframesetgt tags.
  • When a browser that doesnt support frames
    processes this code, it doesnt know what to do
    with the ltframesetgt and ltnoframesgt tags, so it
    ignores them.
  • When you use the ltnoframesgt tag, you must include
    ltbodygt tags, this way, both types of browsers are
    supported within a single HTML file.

29
The ltnoframesgt Syntax
  • The syntax for the ltnoframesgt tag is
  • lthtmlgtltheadgt
  • lttitlegtPage Titlelt/titlegt
  • lt/headgt
  • ltframesetgt
  • Frame Definitions
  • lt/framesetgt
  • ltnoframesgt
  • ltbodygt
  • Page Layout
  • lt/bodygtlt/noframesgtlt/htmlgt

30
Frames and Browsers
  • To test your Web page, use a browser that does
    not support frames.
  • Another way of supporting browsers that do not
    display frames is to create a Web page that
    contains links to the framed and nonframed
    versions of your Web site.
  • It is important to correctly identify the target
    for hyperlinks within frames.
  • by default, the target of the hyperlink will be
    the current frame
  • Use the _top target to hyperlinks to documents
    that lie outside of the Web presentation.

31
Working with Frame Borders
  • There are additional attributes you can apply to
    the ltframegt tag that allow you to change border
    size and appearance. For example
  • you can remove borders from your frames to free
    up more space for text and images
  • you can change the color of the frame border so
    that it matches or complements the color scheme
    for your Web site

32
Setting the Border Color
  • To change the color of a frames border, use the
    bordercolor attribute.
  • The attribute can be applied either to an entire
    set of frames, using the ltframesetgt tag, or to
    individual frames, using the ltframegt tag.
  • The syntax for this attribute is
  • ltframeset bordercolorcolorgt
  • or
  • ltframe bordercolorcolorgt
  • color is either a color name or a color value

33
Setting the Border Color Continued
  • Applying the bordercolor attribute to the
    ltframesetgt tag affects all of the frames and
    nested frames within the set.
  • If you apply the bordercolor attribute to a
    single ltframegt tag, that particular color of the
    border changes in Internet Explorer, but in
    Netscape Navigator, all of the frame borders
    change.
  • View the page using different browsers and
    browser versions.

34
Setting the Border Width
  • Another way of modifying frame borders is to
    change their widths using the border attribute.
  • The border attribute can be used only in the
    ltframesetgt tag, and not in individual ltframegt
    tags.
  • The syntax for the border attribute is ltframeset
    bordervaluegt
  • value is the width of the frame borders in pixels

35
The frameborder Attribute
  • Adding frameborderno to a ltframesetgt tag
    removes the borders from the frames in your page.
  • by removing the borders, more space for the text
    and images in each of the Web pages is created
  • Internet Explorer also supports the framespacing
    attribute, which has the same effect as the
    border attribute.
  • Netscape does not support the framespacing
    attribute.

36
Creating Floating Frames
  • Another way of using frames is to create a
    floating frame.
  • A floating frame, or internal frame, is displayed
    as a separate box or window within a Web page.
  • The frame can be placed within a Web page in much
    the same way as an inline image.

37
The Floating Frames Syntax
  • The syntax for a floating frame is ltiframe
    srcURL frameborderoptiongtlt/iframegt
  • URL is the name and location of the file you want
    to display in the floating frame
  • the frameborder attribute determines whether the
    browser displays a border (yes) or not (no)
    around the frame
  • in addition to these attributes, you can use some
    of the other attributes you used with fixed
    frames, such as the marginwidth, marginheight,
    and name attributes

38
Attributes Associated with the ltiframegt Tag
39
Changing Web Page Content
  • When changing Web page content, you may want to
    reload or refresh the Web page
  • for Netscape, you will need to close and then
    open the file for the changes to the frames to
    take effect. Simply clicking the Reload button,
    your changes are not displayed
  • for Internet Explorer 3.0 and above, in which you
    can view changes to the page by clicking the
    Refresh button
Write a Comment
User Comments (0)
About PowerShow.com