Place Image in an Absolute Position


I’ve been using the Microsoft ActiveX image control to place my images in absolute positions on my Web page. However, I have run into problems with this image component on some PCs. I have tried to reregister the ISCTRLS.OCX, which contains this component, but this does not help. Can you give me an example on how to place an image in an absolute position without using an explicit ActiveX image component?


You can use a DHTML-specific technique to position the image absolutely that will work with IE 4.x and up and Navigator 4.x and up, or any other browser that supports CSS absolute positioning (CSS-P or CSS2). Create an absolutely positioned DIV or SPAN section and place the image within this section. The section, including the image, will be positioned at the location you supply in the CSS style setting. For instance, this code would position the image at 100 pixels from the left and 100 pixels from the top of the browser document:

Unfortunately, this approach won’t work for any browser that doesn’t support CSS Positioning (or CSS2) such as IE 3.x?the ActiveX image control did work with IE 3.x.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin


Recent Articles: