I have a problem with css table. The code below works fine with firefox but the problem is with Internet explorer.
This code actually fetches data from mysql database and display it in the form of table for which I have used CSS. In firefox the fetched are aligned properly but in Internet explorer, the width alignment is messed up.
Here is the code I am using
main.php
Expand|Select|Wrap|Line Numbers
- <html>
- <head>
- <link href="main.css" rel="stylesheet" type="text/css" />
- </head>
- <body>
- <?php
- include("Con.php");
- $query = "SELECT DEG1,DEG2 FROM lists WHERE Grp='$grp'";
- $result = mysql_query($query);
- $num = mysql_num_rows($result);
- echo ("<table class=meal-table>");
- echo ("<tr>");
- echo ("<th scope=col>"."Food Desc"."</td>");
- echo ("<th scope=col>"."Enter Amount"."</td>");
- echo ("<th scope=col>"."Msre Desc"."</td>");
- echo ("</tr>");
- echo ("</table>");
- while ($values = mysql_fetch_array($result))
- {
- echo ("<form name='addmenu' action ='' method='POST'");
- echo ("<table class=meal-table>");
- echo ("<tr>");
- echo ("<td>".$values['DEG1']."</td>");
- echo ("<td>");
- echo ("<input type='textbox' size='3' name='msreval'>");
- echo ("</td>");
- echo ("<td>".$values['DEG2']."</td>");
- echo ("<td>");
- echo ("<input type='submit' value='add' name='submit' size='3'>");
- echo ("</td>");
- echo ("</tr>");
- echo ("</table>");
- echo ("</form>");
- }
- ?>
- </body>
- </html>
Expand|Select|Wrap|Line Numbers
- .meal-table
- {
- padding: 0;
- margin: 0;
- border-collapse: collapse;
- }
- .meal-table th
- {
- border: 1px solid #000;
- padding: 0.5em;
- text-align: left;
- width:150px;
- height:10px;
- }
- .meal-table td
- {
- border: 1px solid #000;
- padding: 0.5em;
- text-align: left;
- width:150px;
- height:10px;
- }
With regards