Centering image in table row using CSS

  Hoseman 18:53 14 Aug 2005
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 2005

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

  Hoseman 20:04 14 Aug 2005

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 2005

<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 2005

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 2005

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

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

Elsewhere on IDG sites

Alienware 17 R4 2017 review

Illustrator Sylvain Tegroeg created thousands of intricate line drawings for the mobile game…

Best iPad buying guide 2017

Comment télécharger une application indisponible en France ?