• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 743
  • Last Modified:

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

0
rknetwork
Asked:
rknetwork
  • 2
1 Solution
 
Pratima PharandeCommented:
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

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now