<p>I am having problems getting text within a table to appear centered in IE. </p>

<p>In Firefox 2, 3 and Safari everything work fine, but for some reason, the text doesn't appear centered in IE 6 or 7. </p>

<p>I'm using:</p>

<pre class="lang-css prettyprint-override"><code>h2 {
  font: 300 12px "Helvetica", serif; 
  text-align: center; 
  text-transform: uppercase;
}
</code></pre>

<p>I've also tried adding <code>margin-left:auto;</code>, <code>margin-right:auto</code> and <code>position:relative;</code> </p>

<p>to no avail. </p>

[{'answer_id': 68621, 'author': 'Mike Becatti', 'author_id': 6617, 'author_profile': 'https://Stackoverflow.com/users/6617', 'pm_score': 3, 'selected': True, 'text': '<p>The table cell needs the text-align: center.</p>\n'}, {'answer_id': 68637, 'author': 'nickf', 'author_id': 9021, 'author_profile': 'https://Stackoverflow.com/users/9021', 'pm_score': 0, 'selected': False, 'text': "<p>The <code>text-align: center</code> should be sufficient, since you're centering the text inside a block element (h2) - adjusting the margins will change the position of the block, not the text.</p>\n\n<p>I wonder if it's just that IE is having a dummy-spit at that <code>font</code> declaration you've got there?</p>\n"}, {'answer_id': 68643, 'author': '1077', 'author_id': 10776, 'author_profile': 'https://Stackoverflow.com/users/10776', 'pm_score': 0, 'selected': False, 'text': '<p>Use text-align:center in the div/td that surrounds the h2.</p>\n\n<pre><code>&lt;table style = "width:400px;border:solid 1px;"&gt;\n    &lt;tr&gt;\n        &lt;td style = "text-align:center;"&gt;&lt;h2&gt;hi&lt;/h2&gt;&lt;/td&gt;\n    &lt;/tr&gt;\n&lt;/table&gt;\n</code></pre>\n\n<p>edit: wow, stackoverflow\'s community is pretty fast!</p>\n'}, {'answer_id': 68678, 'author': 'Alex Achinfiev', 'author_id': 10785, 'author_profile': 'https://Stackoverflow.com/users/10785', 'pm_score': 3, 'selected': False, 'text': '<p>CSS text-align property should be declared on the parent element and not the element you are trying to center. IE uses text-align: center property to center text. Firefox uses margin: 0 auto and it has to be declared on the element you are trying to center.</p>\n\n<pre><code>&lt;div style="text-align: center"&gt;\n    &lt;h2 style="margin: 0 auto"&gt;Some text&lt;/h2&gt;\n&lt;/div&gt;\n</code></pre>\n'}, {'answer_id': 68709, 'author': 'dawnerd', 'author_id': 69503, 'author_profile': 'https://Stackoverflow.com/users/69503', 'pm_score': 2, 'selected': False, 'text': "<p>Might be a typo, but you are missing a semicolon here:</p>\n\n<pre><code>margin-left:auto; margin-right:auto position:relative;\n</code></pre>\n\n<p>Should be:</p>\n\n<pre><code>margin-left:auto; margin-right:auto; position:relative;\n</code></pre>\n\n<p>If that doesn't work, make sure the element you are trying to center the text on has some width. Try setting the width to 100% and see if anything changes.</p>\n"}, {'answer_id': 46956006, 'author': 'Rahi.Shah', 'author_id': 7394106, 'author_profile': 'https://Stackoverflow.com/users/7394106', 'pm_score': 0, 'selected': False, 'text': '<p>If you can/want to use flexbox, you can use the following as well.</p>\n\n<pre><code>display: flex;\njustify-content: center;\nalign-items:center\n</code></pre>\n'}]
['https://Stackoverflow.com/questions/68610', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/10761/']