• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

13. Positioning HTML Elements > 13.1. Making an Element Positionable in the Doc...

Making an Element Positionable in the Document Space

NN 4, IE 4

Problem

You want one or more elements in your page to overlap other elements or appear in a specific location on the page out of rendering order.

Solution

Assign the absolute value to the position CSS property. You can do this in a separate style declaration:

<style type="text/css">
#someElementID {position:absolute; left:100px; top:100px}
</style>

Or you can include the style declaration as an attribute to an element:

<div id="myDIV" style="position:absolute; left:100px; top:100px">Content Here</div>

Give coordinates for the top-left corner of the element relative to the top-left corner of the document.

Discussion

There is nothing particularly dynamic about a positioned element, except that it is loaded with potential for scripting activity in motion, visibility, stacking, and clipping. Except in Navigator 4, the positioned element itself can be of any renderable HTML element, and may thus have event handler assignments (perhaps for mouse dragging) and any HTML content. Even an inline element (such as a span element) becomes a block-level element when it is positioned (even if the display style property value doesn’t necessarily change to reflect its behavior).


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint