问题描述:

I have develop a code for menu which is in the page center. But ie 8 and 9 it is not working. chrome and firefox working fine.

Any one please help me to fix the problem.

Html:

<table width="100%" border="0" cellspacing="0" cellpadding="0" class="hometablebg nowrap">

<tbody><tr>

<td align="center" valign="" style="width: 100%; text-align: center;"> <ul id="topnav" style="text-align: center; margin: auto;">

<li id="t-home1">

Home

</li>

<li id="t-report">Home</li>

<li id="t-report">Home</li>

<li id="t-report">Home</li>

</ul>

</td>

</tr>

</tbody></table>

link:

Visit http://jsfiddle.net/9s0hq5wa/

help me to fix it.

网友答案:

use margin:auto instead, text-align is used for aligning text.

see this fiddle

#topnav {
  float: none;
  font: 12px Arial, Helvetica, sans-serif;
  list-style: none;
  margin: auto;
  display: inline-block;

  padding: 0;
}
网友答案:

Please try to add this to the top of the page:

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />

Found that at some page in the web.

网友答案:

You can try the 'HTML 5 Shiv'

<!--[if IE]><script type="text/javascript" src="excanvas.js"></script><![endif]-->

Put this in the <head> tag, usually clears up some odds and ends in IE.

相关阅读:
Top