Forum Moderators: not2easy
I set up a class in CSS called "swapimage" set as a background with no repeat. Then I applied that to one of two table cells. the cell in question is wider and higher than the image so there is plenty of room for it to move around. That cell is set to align center and valign middle. However the image , being a background, aligns to the top left and I wanted it centered vertically (I don't care about align center).
I have tried everything (vertical-align middle, padding, line height, absolute and relative positioning aplied to the background in CSS) and also setting up a div in that cell and put the class there and nothing works to get it away from the top (setting cellpadding on the whole table doesn't work either).
The code validates and also the CSS.
Here is the CSS without the added changes:
.swapimage {
background-image: url(images/swapimage.jpg);
background-repeat: no-repeat; }
Here is the table layout:
<table align="center" width="760" border="0" cellpadding="0" cellspacing="0" bgcolor="#000000">
<tr><td width="500" align="center">
<img src="images/logo1.gif" width="400" height="146" alt="logo">
</td><td width="260" align="center" valign="middle" class="swapimage">
</td></tr></table>
Am I trying to do the impossible or is there something I'm missing?
background-position:center;