Centering image in table row using CSS

  Hoseman 18:53 14 Aug 05
Locked

Im having problems centering an image (image.gif)in IE although it works in Firefox.

Im not very familiar with CSS and heres the code Im using:

html>
head>
title> /title>
style type="text/css">
!--
td.first {text-align:center}
-->
/style>
/head>

body bgcolor="#33ccff">
table height="483" cellspacing="0" cellpadding="0" width="80%" align="center" bgcolor="#ffffff" border="0">
tbody>
tr>
td class="first" width="702" colspan="3" height="114"> img src="image.gif"> /td>
/tr>

tr>
td width="702" bgcolor="#000000" colspan="3" height="29">
p align="center"> img src="home.gif"> img src="news.gif"> img src="support.gif"> img src="advertise.gif"> img src="contact.gif"> img src="links.gif"> /p>
/td>
/tr>

tr>
td width="234" height="502">
/td>

td width="65%" height="502">
/td>

td width="234" height="502">
/td>
/tr>
/tbody>
/table>
/body>
/html>

Can anyone tell me where Im going wrong? :)

  Forum Editor 19:36 14 Aug 05

CSS generated content, so you'll have to provide IE with background images instead.

  Hoseman 20:04 14 Aug 05

I started using CSS because I wasnt able to centre this image in the cell of a table using the align="center" attribute. What code do I insert for an image to be centred in a cell that will work in both IE & Firefox?

  peabody 21:03 14 Aug 05

<p align="center">

Check that the cell-width is specified correctly; i.e. in pixels. If the cell thinks it's smaller than it is nothing will center correctly in it.

  Eric10 22:39 14 Aug 05

If this is the sort of effect you are after then please feel free to use the code. click here. I find it easier to use separate tables for different parts of the page.

  Hoseman 22:53 14 Aug 05

Thanks for help. Will give it a go and see what happens.

This thread is now locked and can not be replied to.

Huawei P10 review

1995-2015: How technology has changed the world in 20 years

An overview: What leading creative agencies are doing to improve diversity

New iPad, iPhone SE & Red iPhone 7 on sale now