简体   繁体   English

如何对齐此表以使所有 <TD> 正确对齐

[英]How to align this Table to make all <TD>s correctly aligned

How can I align all table rows come correctly aligned even if they have content length differences. 我如何对齐所有表行,即使它们在内容长度上存在差异也可以正确对齐。 Here is the fiddle. 是小提琴。 Please have a look at this.. They are coming vertically aligned.. But I want them one after another like below 请看一下..它们垂直对齐..但是我希望它们像下面这样一个接一个

One  1  Yes
Two  2
Three

Do something like this: 做这样的事情:

<table>  
    <tr>  
        <td width="50px">  
            One  
        </td>  
        <td>  
            1  
        </td>  
        <td>  
            Yes  
        </td>  
    </tr>  
    <tr>  
        <td width="50px">  
            Two  
        </td>  
        <td colspan="2">  
            2  
        </td>  
    </tr>  
    <tr>  
        <td colspan="3">  
            Three  
        </td>  
    </tr>  
</table>

Good ways to style the table cells are: "padding", "text-align", vertical-align", "height", "width", and so on.. 设置表格单元格样式的好方法是:“填充”,“文本对齐”,“垂直对齐”,“高度”,“宽度”等。

This might be what you seek 这可能是您想要的

<table>
    <tr>
    <td>
    One
    </td>
    <td>
    1
    </td>
    <td>
    Yes
    </td>
    </tr>
    <tr>
    <td>
    Two
    </td>
    <td colspan='2'>
    2
    </td>
    </tr>
    <tr>
    <td colspan='3'>
    Three
    </td>
    </tr>
    <table>

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

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