colspan和rowspan问题 [英] colspan and rowspan problem

查看:145
本文介绍了colspan和rowspan问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



因为我是html的新手。我在rowspan和colspan中感到困惑。我希望固定电话低于旧号码电池。有任何想法请告诉我。我编写的代码如下:



HI everyone ,

As i am new in html .I am confused in rowspan and colspan. i want landline cell below the old number cell.any idea please let me know. I wrote the code as follows:

<table border="1">

<tr>
<td> harshal</td>
<td> Raut</td>
<td> mobile</td>
<td rowspan=""> address</td>
<td>old number</td>
</tr>
<tr>
<td  colspan="1">new number</td>
<td> landline</td>
</tr>
</table>







谢谢




Thanks

推荐答案

这是关于ROWSPAN和COLSPAN如何工作的好教程, http://www.htmlcodetutorial.com/tables/index_famsupp_30.html [ ^ ]



如果您将该表视为可能有用的excel文件。看看你的第一行(tr),你有5个单元格(5 tds。)它们都没有colspan,所以你在第一行有5列。旧号码在您的最后一栏中。所以,如果你想要新的数字低于它,你有几个选择,具体取决于你想要它的样子。



你可以拥有那个单一的细胞并且将它清空5这意味着一个单元格将占用所有5列。然后,您可以对齐=右,以便文本一直向右,因此它在最后一个单元格下排列。



然而,更好的方法是在你的固定电话之前放一个td并使它成为colspan 4以便它填满前4列。然后你的固定电话将是第五列,用旧号码排列(如果我算的话)。



使用Excel首先构建它或者可能只是在一张纸上绘制它可能会有所帮助。甚至我们经验丰富的人有时必须首先将它画出来以确保它在视觉上看起来正确。
Here's a good tutorial on the how ROWSPAN and COLSPAN work, http://www.htmlcodetutorial.com/tables/index_famsupp_30.html[^]

If you think of the table as an excel file that may help. Looking at your first row, (tr), you have 5 cells (5 tds.) None of them have a colspan so you have 5 columns in the first row. Old number is in your last column. So, if you want new number to be below it you have several options depending on how you want it to look.

You could have that single cell and colspan it 5 which means that one cell will take up all 5 columns. You then could align="right" so that the text is all the way to the right, so it lines up under the last cell.

However, a better approach, would be to put a td before your landline one and make it colspan 4 so that it fills up the first 4 columns. Then your landline would be the 5th column lining it up with old number (if I counted right).

It may help to use Excel to built it out first or possibly just draw it on a piece of paper. Even us experienced guys have to draw it out first sometimes to make sure it looks right visually.


试试这个 -

Try this-
<table border="1"> 
<tr>
<td> harshal</td>
<td> Raut</td>
<td> mobile</td>
<td> address</td>
<td>old number</td>
</tr>
<tr>
<td colspan="4">new number</td>
<td> landline</td>
</tr>
</table>





检查结果: https://jsfiddle.net/mr8trjvh/ [ ^ ]



这就是你需要的吗?



希望,它有帮助:)



check the result here: https://jsfiddle.net/mr8trjvh/[^]

Is this what you need ?

Hope, it helps :)


这篇关于colspan和rowspan问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆