M
Marc Bradshaw
Hi guys,
After googling this for 2 hours, I've come to the same age old
conclusion: IE sucks. However, before succumbing to the evils of
sticking a pointless table in, I wondered if someone here might know if
there is a workaround.
I'm trying to centre an image within a <div>, both horizontally and
vertically. Firefox 3 handles it with ease, but IE7 seems disinterested.
Here is the CSS I have:
div#content ul#shopitems li div.itemimage {
height: 102px;
width: 102px;
border: 1px solid #17516E;
padding: 1px;
text-align: center;
display: table-cell;
vertical-align: middle;
}
So because div.itemimage has fixed dimensions you would think it easy
but the problem is that the image is dynamically inserted and could be
anything up to 100px by 100px, so I can't use the trick of positioning
the image 50% down and then using a negative top-margin to move it up.
You can see the clearest example at this page, and you can get past the
..htaccess box using the details below:
http://www.spafixdirect.co.uk/products/heater
Username: username
Password: password
In Firefox 3 the item images are neatly centred within the blue boxes.
In IE7 they sit at the top of the blue box, though they are horizontally
centred.
I'm using Windows Vista Business with SP1, which may be relevant as
search results suggest that this problem may be limited to IE on Windows.
Can anyone help?
Thanks in advance,
Marc
After googling this for 2 hours, I've come to the same age old
conclusion: IE sucks. However, before succumbing to the evils of
sticking a pointless table in, I wondered if someone here might know if
there is a workaround.
I'm trying to centre an image within a <div>, both horizontally and
vertically. Firefox 3 handles it with ease, but IE7 seems disinterested.
Here is the CSS I have:
div#content ul#shopitems li div.itemimage {
height: 102px;
width: 102px;
border: 1px solid #17516E;
padding: 1px;
text-align: center;
display: table-cell;
vertical-align: middle;
}
So because div.itemimage has fixed dimensions you would think it easy
but the problem is that the image is dynamically inserted and could be
anything up to 100px by 100px, so I can't use the trick of positioning
the image 50% down and then using a negative top-margin to move it up.
You can see the clearest example at this page, and you can get past the
..htaccess box using the details below:
http://www.spafixdirect.co.uk/products/heater
Username: username
Password: password
In Firefox 3 the item images are neatly centred within the blue boxes.
In IE7 they sit at the top of the blue box, though they are horizontally
centred.
I'm using Windows Vista Business with SP1, which may be relevant as
search results suggest that this problem may be limited to IE on Windows.
Can anyone help?
Thanks in advance,
Marc