acidvisor
15 Jan 2007, 06:10 PM
I have been searching Forums and Online tutorials for day with no avail.
I am trying to vertically center and image (on the Y-axis I think).
This is made even harder by a background image that the image in the foreground needs to be aligned with. Any ideas are a big help.
This is my code so far
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Art House</title>
<style type="text/css">
<!--
body {
background-image: url(bg.jpg);
background-repeat: no-repeat;
background-position: center center;
background-color: #000000;
margin-top: 0px;
}
-->
</style></head>
<body>
<div align="center">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><td align="center" valign="middle"><img src="Home.jpg" width="800" height="600" border="0" usemap="#Map">
<map name="Map">
<area shape="rect" coords="63,561,180,581" href="index.htm">
<area shape="rect" coords="238,561,357,580" href="About.htm">
<area shape="rect" coords="432,561,550,580" href="Wines.htm">
<area shape="rect" coords="596,561,756,580" href="contact.htm">
</map></td>
</tr>
</table>
</div>
</body>
So basically I have two elements to my page a background image and a foreground image. They need to be aligned. I can successfully center the background image with the
background-position: center center;
command. So I need a way to align the foreground image with this.
The end result being that the whole back is centered leaving equal amounts of black on top and bottom of screen whilst optimizing the resizing capabilities.
Thanks
Ben
I am trying to vertically center and image (on the Y-axis I think).
This is made even harder by a background image that the image in the foreground needs to be aligned with. Any ideas are a big help.
This is my code so far
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Art House</title>
<style type="text/css">
<!--
body {
background-image: url(bg.jpg);
background-repeat: no-repeat;
background-position: center center;
background-color: #000000;
margin-top: 0px;
}
-->
</style></head>
<body>
<div align="center">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><td align="center" valign="middle"><img src="Home.jpg" width="800" height="600" border="0" usemap="#Map">
<map name="Map">
<area shape="rect" coords="63,561,180,581" href="index.htm">
<area shape="rect" coords="238,561,357,580" href="About.htm">
<area shape="rect" coords="432,561,550,580" href="Wines.htm">
<area shape="rect" coords="596,561,756,580" href="contact.htm">
</map></td>
</tr>
</table>
</div>
</body>
So basically I have two elements to my page a background image and a foreground image. They need to be aligned. I can successfully center the background image with the
background-position: center center;
command. So I need a way to align the foreground image with this.
The end result being that the whole back is centered leaving equal amounts of black on top and bottom of screen whilst optimizing the resizing capabilities.
Thanks
Ben