Home >Web Front-end >HTML Tutorial >The td column in Table under ie7 and ie8 has a fixed width and is not displayed according to the style setting. Curve solution_html/css_WEB-ITnose
1 <!doctype html> 2 <html> 3 <head> 4 <meta charset='utf-8'> 5 <style> 6 .title {background-color:#ccc;width: 150px} 7 </style> 8 </head> 9 <body>10 <table style='width:600px'>11 <tr>12 <td class='title'>哈哈</td>13 <td>aa</td>14 <td class='title'>大都市</td>15 <td>bb</td>16 </tr>17 <tr>18 <td class='title'>adad</td>19 <td colspan='3'>alkjd阿拉快的拉拉alkjd阿拉快的拉拉alkjd阿拉快的拉拉alkjd阿拉快的拉拉alkjd阿拉快的拉拉alkjd阿拉快的拉拉alkjd阿拉快的拉拉alkjd阿拉快的拉拉alkjd阿拉快的拉拉alkjd阿拉快的拉拉alkjd阿拉快的拉拉alkjd阿拉快的拉拉alkjd阿拉快的拉拉alkjd阿拉快的拉拉alkjd阿拉快的拉拉alkjd阿拉快的拉拉alkjd阿拉快的拉拉alkjd阿拉快的拉拉alkjd阿拉快的拉拉alkjd阿拉快的拉拉alkjd阿拉快的拉拉alkjd阿拉快的拉拉alkjd阿拉快的拉拉alkjd阿拉快的拉拉alkjd阿拉快的拉拉alkjd阿拉快的拉拉alkjd阿拉快的拉拉alkjd阿拉快的拉拉alkjd阿拉快的拉拉alkjd阿拉快的拉拉alkjd阿拉快的拉拉alkjd阿拉快的拉拉</td>20 </tr>21 </table>22 </body>23 </html>View Code
In this case, the three columns in the first row will be significantly expanded under ie7 and ie8. It fails to display
according to the style width (width: 150px). Solution:
1. Hard-code the width of each column
2. Change width:150px to width: 20% as a percentage