Full Window Flash With Minimum Dimensions

The Problem

You want a Flash SWF to take up the entire window and resize with it, but you need scroll bars if the window gets too small.

The Solution

We came up with a simple CSS based solution that avoids the use of JavaScript unless IE 6 or less is used. This reduces complexity, JavaScript dependency, and fragility when browsers are updated or JavaScript frameworks are used. The concept was originally illustrated in the article "Full Window Flash (With Minimum Dimensions), Done Right" on our blog

Since then we’ve updated the example to properly support the following browsers as of 2011-03-08:

Live Example

Here is a live example. The scroll bars should only appear if the Flash area is less than 800x600px.

Usage

This example, code, and concepts may be used commercially, but not resold or rebranded. Please try to preserve or provide credit to us. All other open-sourced code, such as SWFObject is owned by their respective parties.

Download

You can download a complete copy of the example and supporting files. This includes:

Unnecessary Alternate Solutions

These solutions are unnecessary as they rely solely on JavaScript. Our method is 100% CSS based, unless you are using IE 6 or below which includes some minor JavaScript to add min-width/min-height behavior.

Change Log