devxlogo

Place Image in an Absolute Position

Place Image in an Absolute Position

Question:

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?

Answer:

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.

See also  Why ChatGPT Is So Important Today
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist