简体   繁体   English

CSS和PHP布局问题

[英]Css and php layout issues

I am using a table coded through php to form two column results with an xml feed, the columns form ok, the problem is that the second column gets cut off. 我正在使用通过php编码的表,以xml feed形式形成两列结果,列形式确定,问题是第二列被截断了。

example here: http://www.qrrw.net/b 此处的示例: http : //www.qrrw.net/b

my css 我的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;
}

When i use the chrome web developer plugin it shows that the second column has a different width, but it is using the same class. 当我使用chrome web开发人员插件时,它表明第二列具有不同的宽度,但它使用的是同一类。

below is my PHP-Code : 以下是我的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>';
    }
}
?>

final HTML 最终的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>

Thanks 谢谢

You did mistake in your css. 您在CSS中犯了错误。
Check the commented line in below css.. 检查下面css中的注释行

change width:478; 更改宽度:478; to width:478px; 宽度: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;
}
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;
    }

and

Change Table Width 变更表格宽度

<table width="907px" border="0">
      <!-- put Code here -->
</table>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM