Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

centering static page elements

Status
Not open for further replies.

blues77

Programmer
Jun 11, 2002
230
CA
Does anyone know how I can center a image on my document when it is maximized but doesn't keep recentering it when the window in shrunk. In order words i want it to be perfectly centered when the page in viewed normally but doesn't change positions when the window is shrunk.
any help is appreciated!

thanks
 
hi,

If you have a fixed width table you can center the image in that. Problem is what width do you set the table? Remember it should be viewable in different resolutions.

<table summary=&quot;&quot; width=&quot;700&quot; cellpadding=&quot;&quot; cellspacing=&quot;&quot;>
<tr>
<td align=&quot;center&quot;>
<img src=&quot;&quot; alt=&quot;&quot;>
<td>
<tr>
</table>
you could center the table and allow it to move a little when the browser changes size or you could leave it left and there would be no movement. ?

Another thing you might try is to position the image with CSS, enclose the image in a div or span something like this

<span style=&quot;position: absolute; left:300px; top:50px;&quot;>
<img src=&quot;&quot; alt=&quot;&quot;>
</span>

Doubt this will solve your problem but play around with it. Hopefully one of the guys knows a better way!
It's late and my brain is offline!


É

endamcg-logo1b.gif

 
use layers

<div style=&quot;position:absolute; top:250px; left:250px&quot;><img src = &quot;/images/myimage.gif&quot; /></div

this will put a picture 250 pixel down from the top and 250 over from the left. But what you will need to do is to decide what the page size you are creating for (800x600, 1024x786, etc) and then pick the place where your image ins centered.

hth
Bastien

There are many ways to skin this cat,
but it still tastes like chicken
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top