Avoid frame-based layouts in favor of alternative designs
Takeaway: Most Web developers view frames as relics and opt for newer technologies such as CSS or AJAX instead. Tony Patton outlines some of the issues with frames and lists benefits of alternative designs.
I recently met with a client to discuss a Web application for internal use. The meeting was going smoothly until he stated a preference for frames. That's right—he preferred frames for site layout. I couldn't remember the last time I actually coded an application with frames. His motives originated with replicating an existing VB application, so it was hard to argue the point. These days, frames are frowned upon, but I had a hard time remembering why. In this article, I explain why you should avoid frames and consider alternate technologies.
The concept
Frames were a cool concept when first introduced many years ago. I can remember coding sites with individual frames for banners, navigation, and site content. The concept is simple if you are unfamiliar with frames. Basically, HTML frames allow you to divide the browser window into individual spaces or frames.
The frame and frameset HTML elements are used to create frame-based layouts. The frame element defines individual spaces or frames. These frames are contained within the frameset element. The cols and rows attributes of the frameset element define the layout of the frames contained within it. The HTML in Listing A creates a sample frameset. The Web Development Zone archive is loaded in the left frame while the Download.com site is loaded in the right frame.
The scrolling attribute of each frame signals whether the user may scroll within the frame (yes) or not (no), and the noresize attribute says the frame may not be resized so its width is static. The noframes element provides what is displayed in browsers lacking support for frames. There are other options available; refer to an HTML resource for more information.
Loading two Web sites is not the most practical application. Frames have often been used to place a navigation pane on the left or top and content on the right or bottom. This is easily achieved by setting the frame's width (or height) and loading the necessary page(s). The frame concept is simple, but it is viewed with disdain by most Web developers.
Drawbacks
These days, frames are frowned upon by the Web development community. In fact, they are no longer supported in the XHTML 1.1 specification. It is replaced by XFrames. So this may provide one reason to avoid frames, but what about currently supported standards? The following list provides an overview of the reasons frames are not in widespread use:
- Many Web developers are philosophical when frames are discussed. They say frames violate basic concepts of the Web because it is a large collection of individual pages that may or may not be linked.
- While most browsers render frames as designed, it is not the case with nontraditional browsing platforms like cell phones, PDAs, and so forth. Frame-based layouts are confusing—if not useless—on these platforms.
- Search engines have problems processing sites organized with frames. Some search engines, like Google, skip framed content altogether and simply index the noframes content.
- Coding and design can be a problem when pages are designed for a predefined frame-based area. Problems may arise when these pages are viewed individually and layout is hideous.
- The browsing experience for users can be irritating with framed sites. Bookmarking such sites often bookmarks the entire frameset and context is ignored, so users find it difficult to bookmark specific content. Another issue is printing, but most browsers allow users to choose to print the entire frameset or individual frames.
- Frames cause various accessibility problems. The visual layout of frames is difficult to translate to nonvisual browsers. A good rule is to provide textual descriptions of all elements and include content for browsers that don't support frames. The online guidelines provide more details.
Alternative designs
The introduction of frames occurred in the pre-CSS days of the Web. Nowadays, CSS can be used to provide frame-esque designs. The first example can easily be re-created with CSS as Listing B demonstrates.
In this simple example, the background colors of each div are included for demonstration. You can create more robust layouts with CSS; the Yahoo! User Interface Library provides great examples. You may also use AJAX to improve data loading, which is often a reason for using frames (since frames may not have to be reloaded as frequently).
Another presentation option
Frames are relics in most Web developers' eyes. Once beloved, frames became passé as technologies like CSS provided better options. I'd love to hear your opinion of frames. Please share your thoughts and experiences in the article discussion.
And, in case you were wondering, I was able to persuade the client to go with a design featuring CSS to handle page layout.
Miss a column?
Check out the Web Development Zone archive, and catch up on the most recent editions of Tony Patton's column.
Tony Patton began his professional career as an application developer earning Java, VB, Lotus, and XML certifications to bolster his knowledge.
Print/View all Posts Comments on this article
White Papers, Webcasts, and Downloads
- Building the Virtualized Enterprise with VMware Infrastructure VMware This paper explains how adopting a virtual infrastructure -- comprised of server, storage, and networking virtualization technologies -- can help your organization build a sustainable competitive ... Download Now
- Email Security and Archiving - Clearer in the Cloud Google The time is NOW for businesses and organizations of all sizes to implement ... Download Now
- The Scalable Enterprise: VMware ESX Server on the Dell PowerEdge 6650 Dell This paper introduces the server virtualization software, VMware ESX ... Download Now
- VMware Infrastructure: A Guide to Bottom-Line Benefits VMware Frustrated by the high cost of maintaining or building ever-larger data centers? Get the facts you need to formulate your Virtualization Action Plan. Download Now
- Tom Davenport Study: Linking decisions and information for organizational performance IBM Tom Davenport's new client study looks at approaches to linking ... Download Now
Article Categories
- Security
- Security Solutions, IT Locksmith
- Networking and Communications
- E-mail Administration NetNote, Cisco Routers and Switches
- CIO and IT Management
- Project Management, CIO Issues, Strategies that Scale
- Desktops, Laptops & OS
- Windows 2000 Professional, Microsoft Word, Microsoft Excel, Microsoft Access, Windows XP,
- Data Management
- Oracle, SQL Server
- Servers
- Windows NT, Linux NetNote, Windows Server 2003
- Career Development
- Geek Trivia
- Software/Web Development
- Web Development Zone, Visual Basic, .NET

