tags:

views:

30

answers:

1

Per customer request I need to put an image in a form (via cforms in wordpress). As you really can't display images there, I just abused a label field like this:

01a Contact Information <img style ="height: 155px; width:668px; position:absolute; top:235px; left:617px;" src ="image.jpg" />

Problem is that once I use position: relative it will extend the borders of that fieldset, that's why I chose position: absolute.

Of course the page is centered and this creates problems with screen resolution. I can't create a div around this as explained here.

See a screenshot

What's the best code to use this?

+1  A: 

You don't need to place the position: relative on a element that is the immediate parent of the image you are working with here - it could be any of its parents, such as the form element, or the container for the entire centered page.

As long as the element you place position: relative is part of the page that is centered the AP (absolute positioned) element will take reference from that element, and your img will be centered like the rest of the page.


If you want us to provide alternatives to what you're doing, the you need to tell us clearly what you are trying to do. Putting an image there is as simple as including the tag, but clearly your problem has to do with positioning - so tell us what sort of positioning you need for that image. If I were to list out all possibilities it would be a very long list.

Yi Jiang
thanks, once i thought it through again i just gave one other div position:relative and it worked.
Julian