0

我正在使用通过 php 编码的表来形成带有 xml 提要的两列结果,列形式正常,问题是第二列被截断。

这里的例子: http ://www.qrrw.net/b

我的 CSS

td.manu {
    background: url("../images/manu_button.fw.png") no-repeat; 
    height: 87px; 
    width:478;  
    font-family:Arial,Helvetica, sans-serif; 
    color:#309;
    font-size:12px;
}

当我使用 chrome web developer 插件时,它显示第二列的宽度不同,但它使用的是同一个类。

下面是我的PHP 代码

$count = 0;
$max = 2;
foreach($xml->name as $name){               
    $count++;
    echo '<td class="manu">'. $name['name'];'</td>';

    if($count >= $max){
        //reset counter
        $count = 0;
        //end and restart
        echo '</tr><tr>';
    }
}
?>

最终的 HTML

  <table border=0 width="800px">
  <tr>
  <td class="manu">3000 ME</td><td class="manu">Ace</td></tr><tr><td class="manu">Cobra MK IV</td>    </tr></table>

谢谢

4

2 回答 2

4

你在你的css中犯了错误。
检查下面css中的注释行..

改变宽度:478;宽度:478px;

td.manu {
  background: url("../images/manu_button.fw.png") no-repeat; 
  height: 87px; 
  width:478;  /*------------------- add "px" after the value here--------------*/  
  /*----- 478px instead of only 478 ------*/
  font-family:Arial,Helvetica, sans-serif; 
  color:#309;
  font-size:12px;
}
于 2012-11-09T10:05:54.567 回答
1
td.manu 
{
background: url("../images/manu_button.fw.png") no-repeat; 
height: 87px; 
width:478;  
font-family:Arial,Helvetica, sans-serif; 
color:#309;
font-size:12px;
padding-left:23px;
}

.manu a
    { 
       padding-left: 0;
    }

更改表格宽度

<table width="907px" border="0">
      <!-- put Code here -->
</table>
于 2012-11-09T09:58:14.683 回答