Centering an image

Associate
Joined
6 Feb 2003
Posts
751
Location
Sutton
I have a webpage, using dreamweaver 4, with a white background and one single image.

I want the image to appear in the centre of the whole page no matter what screen resolution will be used.

Is this possible and if so how.
 
Soldato
Joined
17 Oct 2002
Posts
3,018
The horizontal centering part is easy but vertical centering can be a little tricky sometimes. I can't think of a way of doing it off the top of my head with CSS but you could very easily do it with some nested tables. :)
 
Associate
Joined
4 Aug 2004
Posts
1,890
Location
Grenoble, France
You could set the image as the background for the page:
Code:
<style type="text/css">
body { background: white url(image.jpg) no-repeat middle center; }
</style>
I think that's right. Add it to your code between <head> and </head>
 
Last edited:
Back
Top Bottom