简体   繁体   English

表TD对齐单元格固定在底部吗?

[英]Table TR TD align cell fixed at bottom?

I'm trying to get my row/cell that displays "Daily total" to stick to the bottom .. as you can see in my image one is higher than the other because of an extra entry inputted... 我试图使显示“每日总数”的行/单元格停留在底部..正如您在我的图像中看到的那样,由于输入了额外的条目,其中一个高于另一个。

在此处输入图片说明

i've tried many different valign and vertical-align but cant figure it out.. maybe someone can help me? 我已经尝试了许多不同的valign和vertical-align但无法弄清楚..也许有人可以帮助我吗?

here is the html for that tr/td: 这是该tr / td的html:

echo "<tr><td class=\"daily_total_style\" valign=\"bottom\"><b>Daily Total: " . calcMinutes($dailytotal) . "</b></td></tr>";

much better to use a css rule than attributes 使用CSS规则比使用属性要好得多

<td class=\"daily_total_style\" style=\"vertical-align: text-bottom\">

EDIT: it's also better to assign this style to a class and assign also this class to your td 编辑:最好也将此样式分配给一个类,并将该类也分配给您的td


CATCHED THE ERROR: 发现错误:

You are applying valign to inner td , not container one. 您正在将valign应用于内部td ,而不是容器一。

Your td cointainer have to look like this: 您的td硬币容器必须如下所示:

<td class="calendar_cell_middle" width="14%" valign="bottom" height="25%">

however, valign it's not more supported in HTML5, so try to include it as css. 但是,valign在HTML5中不再受支持,因此请尝试将其包含为CSS。 More, avoid this inner tables, are really hard to manage ! 更多,避免使用此内部表,真的很难管理!

You should use the following for your td in css: 您应该将以下内容用于css中的td

td {
    vertical-align:bottom
}

Also make sure that you don't forget to add the table tags to your code like so: 还要确保不要忘记将table标记添加到代码中,如下所示:

<table>
    <tr>
        <td class="daily_total_style">
            <b>Daily Total 1</b><br />
            <b>Daily Total 2</b><br />
        </td>
        <td class="daily_total_style">
            <b>Daily Total</b>
        </td>
    </tr>
</table>

You will find a fiddle demo here 您将在此处找到小提琴演示

Additionally you may want to review what you have added in your daily_total_style css class; 另外,您可能想查看您在daily_total_style css类中添加的daily_total_style something in there might be interfering with your code. 其中的某些内容可能会干扰您的代码。

EDITED: I updated your fiddle you just created with the above and it works fine: check it out here 编辑:我用上面的方法更新了您刚刚创建的小提琴,并且效果很好: 请在此处查看

您可以在第一行和最后一行之间包含一个空白行,然后为所有表数据设置固定宽度,如果两个表都有3行,这将使两个表看起来更加相似

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

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