IE wont center content in td

IE wont center content in td

CSS class or style "text-align:center" does NOT fix this
<div align="center"> or <center> does NOT fix this

Adding one extra column without width - fixes it
Also removing width from all columns fixes it
None of the above are solutions for me

All other browsers don't have this issue

Hate this fu-ken sh-t called IE

Please HELP!
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<title>Untitled Document</title>
</head>
<body>
<table width="100%" border="2" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="75" align="center">test</td>
    <td width="75" align="center">test</td>
    <td width="75" align="center">test</td>
    <td width="75" align="center">test</td>
    <td width="75" align="center">test</td>
  </tr>
</table>
</body>
</html>

Open in new window

LVL 6
rknetworkAsked:
Who is Participating?
 
Pratima PharandeConnect With a Mentor Commented:
try this
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<title>Untitled Document</title>
</head>
<body>
<table width="100%" border="2" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="20%" align="center">test</td>
    <td width="20%" align="center">test</td>
    <td width="20%" align="center">test</td>
    <td width="20%" align="center">test</td>
    <td width="20%" align="center">test</td>
  </tr>
</table>
</body>
</html>

Open in new window

0
 
Pratima PharandeCommented:
OR try this
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<title>Untitled Document</title>
</head>
<body>
<table width="375" border="2" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="75" align="center">test</td>
    <td width="75" align="center">test</td>
    <td width="75" align="center">test</td>
    <td width="75" align="center">test</td>
    <td width="75" align="center">test</td>
  </tr>
</table>
</body>
</html>

Open in new window

0
 
mvgeertruyenCommented:
The 100% width of the table conflicts with the settings in the columns - either set the table width or the column width (so that the sum of the columns equals the width of the table)

hope it helps
<table border="2" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="75" align="center">test</td>
    <td width="75" align="center">test</td>
    <td width="75" align="center">test</td>
    <td width="75" align="center">test</td>
    <td width="75" align="center">test</td>
  </tr>
</table>
 
or use the same unit:
 
<table border="2" width="100%" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="20%" align="center">test</td>
    <td width="20%" align="center">test</td>
    <td width="20%" align="center">test</td>
    <td width="20%" align="center">test</td>
    <td width="20%" align="center">test</td>
  </tr>
</table>

Open in new window

0
 
rknetworkAuthor Commented:
Specifying percentage everywhere works, not sure how come it's interfering with aligning but works
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.