Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 HTML Frames

Similar presentations


Presentation on theme: "1 HTML Frames"— Presentation transcript:

1 1 HTML Frames http://jjcweb.jjay.cuny.edu/ssengupta/

2 Objectives  Explore the uses of frames in a Web site  Display a document within a frame  Format the appearance of a frame 2

3 What is a frame?  A frame is a section of the browser window capable of displaying the contents of an entire Web page 3

4 Remember!  The browser has to load multiple HTML files when working with frames 4

5 Planning Your Frames first  Before you start creating your frames, plan their appearance and how they are to be used: o What information will be displayed in each frame? o How do you want the frames placed on the Web page? o What is the size of each frame? o What Web pages will users first see when they access the site? o Should users be permitted to resize the frames to suit their needs? 5

6 Planning Your Frames 6

7 Frameset  A frameset describes the frame layout  The element is used to store the definitions of the various frames in the file. These definitions will typically include: o Size and location of the frame o Web pages the frames display 7

8  What is the tag used for frameset?  …  example Learning Frames define frames here 8 Frameset

9 Frames Defined in Either Rows or Columns 9

10 Frames in rows or columns  You must choose to layout your frames in either rows or columns  To create a frame layout, you will use the rows and cols attributes of the element o The rows attribute creates a row of frames o The cols attribute creates a column of frames 10

11  Creating a row frame layout o attribute name: rows o attribute value: number of pixels | percentage | *  Creating a column frame layout o attribute name: cols o attribute value: number of pixels | percentage | * 11 rows, cols attribute for

12 Content of frames  So, now I have created the frame layout!!  But, what goes inside the frames? HTML files!!! 12

13  use tag within o & tags 13 Define frame source

14 Create Frames with column layout 14

15 Creating a Nested Set of Frames in the Second Frame Row 15

16 16 Nesting framesets  nesting one pair of tags in another

17 Formatting a Frame  You can control three attributes of a frame: o Scroll bars o The size of the margin between the source document and the frame border o Whether or not the user is allowed to change the size of the frame 17

18 Hiding and Displaying 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: scrolling=“type” o scrolling can either be “yes” (to always display scroll bars) or “no” (to never display scroll bars) 18

19 Example: Removing the Scroll Bars 19

20 Specifying Margins Syntax  The syntax for specifying margins for a frame: marginheight=“value” marginwidth=“value” o marginheight is the amount of space, in pixels, above and below the content of the page in the frame o 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

21 21 Resizing of frames  restrict resizing of a frame o attribute name, noresize

22 22 Name of a frame  Also, very important: assign name to frames o attribute name, name o attribute value, “frame_name” o Note, you can provide any unique name for a frame. We will see shortly why frame name is important.

23 Example 23

24 24 More attributes for tag  change width of frame border o attribute name: border o attribute value: “number of pixels”  change color of frame border o attribute name: bordercolor o attribute value: “a color”  example ……

25 Working with Frames and Links  By default, clicking a link within a frame opens the linked file inside the same frame  You can display hyperlinks in many ways: o In a different frame o In a new window o In the entire window  When you want to control the behavior of links in a framed page, there are two required steps: o Give each frame on the page a name o Point each hyperlink to one of the named frames 25

26 Specifying a Link Target  You can use the target attribute to open a page in a specific frame  The syntax for this is: target=“name” 26

27 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: o Where the name of the frame is unavailable o When you want the page to appear in a new window o 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

28 Using Reserved Target Names 28

29 Using the _self Target 29

30 Using the Element  Use the element 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 elements and concentrates solely on the code within the elements  When a browser that doesn’t support frames processes this code, it doesn’t know what to do with the and elements, so it ignores them  When you use the element, you must include elements, this way, both types of browsers are supported within a single HTML file 30

31 The Syntax  The syntax for the element is: title frames page content 31

32 Frameless Version of a Web Site 32


Download ppt "1 HTML Frames"

Similar presentations


Ads by Google