php - 对齐错误 - HTML 表格

标签 php html css

所以我有这个

screenshot

<?php
$username = $_SESSION['username'];
$sql = mysql_query("SELECT * FROM `users` WHERE `username`='$username'");
while($row = mysql_fetch_array($sql))
{
$cash = $row['cash'];
$exp = $row['exp'];
$maxExp = $row['max_exp'];
$health = $row['health'];
$energy = $row['energy'];
$stanima = $row['stanima'];
$maxStanima = $row['max_stanima'];
$maxEnergy = $row['max_energy'];
?>
<div id="statsBox">
<table width="100%">
<tr>
<td width="2490px" height="20px">
<?php
echo '<b><font color="#00FF00" face="verdana">$'.$row['cash'].'</font></b>';
?>
</td>
<td width="5000px" height="20px">
<center>
<?php
echo '<b><font color="white" face="verdana">'.$energy.'/'.$maxEnergy.'</font></b>';
?>
</center></td>
<td width="2510px" height="20px">
<div class="right">
<?php
echo '<a href="index.php"><b><p class="White">'.$stanima.'/'.$maxStanima.'</p></b>    </a>';
 }
}
?>
</div>
</td>
</tr>
<div id="statsBox">
<table>
<tr>
<td width="2490px" height="20px">
<?php
echo '<b><font color="#00FF00" face="verdana">'.$health.'/100</font></b>';
?>
</td>
<td width="5000px" height="20px">
<center>
<?php
echo '<b><font color="white" face="verdana">'.$energy.'/'.$maxEnergy.'</font></b>';
?>
</center></td>
<td width="2510px" height="20px">
<div class="right">
<?php
echo '<a href="index.php"><b><p class="White">'.$stanima.'/'.$maxStanima.'</p></b>    </a>';
?>
</td></tr>
    </table>
</div>
</div>
</div>

我想要将底部的 3 项上移。一切都在 2 个不同的表中。我试过组合表格,但它弄乱了底部中间元素的对齐方式。

现在已经很完美了,但我想知道如何以某种方式降低表格高度以使底部的 3 个元素更靠近顶部?

最佳答案

在第二个表中,您可以添加类并在 css 中指定其高度,或者简单地在第二个表中添加内联 css

<table style="height:25px;">

关于php - 对齐错误 - HTML 表格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23668258/

相关文章:

php - 如何在Docker容器中为Laravel运行和安装Protractor E2E测试?

html - 在右侧 float 一个 "<li>"的字体图标

javascript - 使用 node.js 将重复的 HTML 片段导入到其他 html 文件中

JavaScript:检测 CSS3 动画何时结束

javascript - 在 Mm 中使用 Javascript 获取 Div 的内部宽度

javascript - 使用 .innerHTML 将 <div> 替换为另一个 html 页面?

php - 使用 php 检测 rmdir 错误

php - 错误的整数值 : '' for column 'id'

php - Symfony2 : deprecated get in FormView replacement?

jquery - Div 在 jQuery 函数后没有正确显示