| home / experts / dhtml / column8 |
|

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 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
All Rights Reserved. Legal Notices.
Created: Nov. 5, 1997
Revised: Jan. 18, 1998
URL: http://www.webreference.com/dhtml/column8/puzzCSS.html