spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / experts / dhtml / column8
Developer News
Mandrake Linux Founder Back, Virtually
Amazon: We're a Technology Company
Sun Expands MySQL With Closed Source
Logo

The DHTML Lab Jigsaw Puzzle, Part I: IE4
defining the CSS elements


Our puzzle has three unique positioned elements. The puzzle element is the most important as it contains the others. It is, therefore our parent element. We define it in our in-page style sheet:

The left and top properties above are placeholders. Set them to whatever coordinates you want the puzzle to appear in your page. The width property is set to any value. It is required by IE4, but will be modified later when our image is loaded. Our visibility is set to hidden to allow our puzzle to fully load before the user sees it. The border property can also be modified to any that you prefer. If a border is used, remember that a border is appended to an element's boundaries. It is not contained within them. Thus, in the above example, our element would be 106 pixels wide on the page:

Within our puzzle element, we will be placing:

The image will be placed with the IMG tag and be part of the page flow. The grid, however, must occupy the same physical space as the image, which places it outside the regular HTML flow. It must be a positioned element with a position value of absolute. The grid element will be nested within the elPuzzle parent element. The left and top properties are set to 0, placing it in the top-left corner of elPuzzle. This nesting of elements is described in detail in column2. Define the grid element:

The third element, the control panel, is also nested within elPuzzle, but it appears after the puzzle image. The control panel must be part of the HTML flow, and always appear below our image. Our puzzle images are all different sizes, so our controls should adjust position with each new image. This element, therefore, has a position value of relative:

We have added some CSS formatting to our panel for better display. The padding property will give us some minimum space around the control panel HTML. A <BR> tag would give us too much space. The height property is, like width in elPuzzle, required for our element to format properly and is given a placeholder minimum value.

We can now place the elements in our HTML.

The next step is to flesh out the HTML.


Produced by Peter Belesis and

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

webref The latest from WebReference.com Browse >
Working with the DOM Stylesheets Collection · Administering RBAC in PHP 5 CMS Framework · xref: Automatic Cross Referencing Script
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Combine BottomCount() with Other MDX Functions to Add Sophistication · Creating a Daemon with Python · The Coming Voice-over-WiMAX Revolution

All Rights Reserved. Legal Notices.
Created: Nov. 5, 1997
Revised: Jan. 18, 1998

URL: http://www.webreference.com/dhtml/column8/puzzCSS.html