Top Banner
XP Tutorial 5: Using Frames in a Web Site
48
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript

tag. the reason for this is that this HTML file displays the contents of other Web pages; technically, it is not a Web page 8. XP Specifying Frame Size andOrientation To create a frame layout, you will use the rowsand cols attributes of the 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 notboth. You must choose to layout your frames in eitherrows or columns. 9. XP Frames Defined ineither Rows or Columns This figure showsframe layouts in either rows or columns. 10. XP The Frame Syntax The syntax for creating a row or column framelayout is: row height is the height of each row or column width is the width of each column 11. XPRow and Column Sizes Row and column sizes can be specified in threeways: in pixels as a percentage of the total size of the frameset by an asterisk (*) 12. XP Defining Rows and Columns Using an Asterisk (*) The asterisk instructs the browser to allocate any unclaimed spacein the frameset to the particular row or column. for example, the tag creates tworows of frames. Specify at least one of the rows or columns of your 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 amongthe frames with the asterisks. for example, the tag creates threerows of frames with equal heights. 13. XP Frames of Different SizesThis figure shows frames of different sizes.160 pixels wide 25% of thewhatever space is left width ofthe display area 14. XPCreating Two Rows of Frames tag creates two rows of frames: the first 85 pixels high and the second occupying theremaining display area 15. XP Specifying a Frame Source To specify a source for a frame, use the tag with the syntax: The URL is the filename and location of the pagethat you want to load. You must insert the tag between theopening and closing tags. 16. XP Logo and Placementlogo frame rest of the framessource forthe firstframe 17. XPWeb Site with Frames heading extends beyond the frameThe design of theborder, causing a vertical scrollframe layout could bar to be displayeduse somerefinement.The appearance ofscroll bars may ormay not beappropriate for theweb pages. table of home page contents frameframe 18. XPControlling the Appearance of 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 19. XPControlling the Appearanceof Scroll Bars By default, scroll bars are displayed when the content ofthe source page cannot fit within the frame. You can override the default setting using the scrollingattribute. The scrolling syntax is: 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, thebrowser displays scroll bars when necessary. 20. XPRemoving the Scroll Bars from the Logo FrameIf the complete textcannot be displayedset the scrollingafter removing the attribute to no toscroll bars from a remove the scrollframe, you will need tobarsmodify the framemargin. 21. XP Specifying the MarginSizes for the FramesThe margin height is set height of the marginto 0 pixels. text for the logo framewill be 0 pixelsThe frame margin widthis set to 10 pixels, tokeep the page fromrunning into the bordersof its frame.height of the margin for thehome page will be 0 pixelsand the width of the marginwill be 10 pixels 22. XP Working with Frames and Hypertext Links By default, clicking a hyperlink within a frame opens the linkedfile 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 aframed page, there are two required steps: give each frame on the page a name point each hyperlink to one of the named frames 23. XP Files and Hyperlinks in a Web Sitehome.htm tours.htmphilosph.htm staff.htmlessons.htm 24. XPAssigning a Name to a Frame To assign a name to a frame, add the name attributeto the frame tag. The syntax for this attribute is: 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 25. XP Name: logoFirst frameset Name: links Name: pages Nested frameset 26. XPAssigning a Name to Each FrameOnce the frames arenamed, the next taskis to specify thetarget frame for eachhyperlink. the frame name 27. XP Specifying a Link Targethome.htm tours.htmphilosph.htm staff.htmlessons.htm 28. XP Specifying a Link Target You can use the target attribute to open a page in aspecific frame. The syntax for this is: frame_name is the name youve assigned to a frame on your Web page When a page contains dozens of hyperlinks that should allopen in the same frame, HTML provides a way to specifya target frame for all the hyperlinks within a single page. 29. XPAssigning a Target to a Hyperlinkthe Web page willappear in the pagesframe 30. XPUsing the Tag Use the tag to specify the default target forhyperlinks 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 tag is the targetattribute, which identifies a default target for all of thehyperlinks in a page. The syntax for this attribute is: frame_name is the name of the target frame 31. XPUsing the Tag Continued The tag is useful when your page contains a lotof hypertext links that all point to the same target. Rather than adding the target attribute to each tag,you can enter the information once with the tag. You can still use the tag even if your file containslinks that point to a different target than the one specifiedin the tag. The target in the tag overrides any target specified inthe tag. 32. XPSpecifying a Default Target for all Hyperlinksthe target of all linkswill be the pagesframe 33. XP Using the Tag Use the tag to allow your Web site to be viewableusing browsers that do or do not support frames. When a browser that supports frames processes this code, it ignoreseverything within the tags and concentrates solely onthe code within the tags. When a browser that doesnt support frames processes this code, itdoesnt know what to do with the and tags, so it ignores them. When you use the tag, you must include tags, this way, both types of browsers are supported within a singleHTML file. 34. XP The Syntax The syntax for the tag is:Page TitleFrame DefinitionsPage Layout