HIOX印度
免费的HTML教程
 首页   ||  教程  ||  脚本  || 支持 english Español Français Deutsch

HTML Basic
导言
如何
HTML标签
html, head, body
文本操作
图像
特殊效果
使用表
形式
其他议题
反馈



表格对齐代码


主题

如何对齐表格?
如何对行和列中的文字进行定位?



解释

表格对齐
通过使用表格标记中的属性"align",表格可以对齐到左/右/居中

例如代码:
<table border=1 bgcolor="green" width=300 height=100 align=center>
<tr height=30>
<td>
HAI
</td>
<td>
Hello
</td>
</tr>
<tr height=70>
<td>
Table Alignment
</td>
<td background="./test.jpg">
This is 2nd row 2nd column <br><br> Nice background
</td>
</tr>
</table>



结论:
HAI Hello
Table Alignment This is 2nd row 2nd column

Nice background


对齐列内的内容(文本)
通过使用标记的属性"align",列中的内容(文本、图像...)能够水平对齐。
通过使用标记的属性"valign",列中的内容(文本、图像...)能够垂直对齐。
ALIGN的属性值设置为LEFT/RIGHT/CENTER
VALIGN的属性值设置为TOP/BOTTOM/CENTER

例如代码:
<table border=1 bgcolor="green" width=80% height=30%ALIGN=center>
<tr height=20%>
<td align=center>
center
</td>
<td align=right>
right
</td>
</tr>
<tr height=70% >
<td valign=top>
top
</td>
<td valign=bottom align=right background="./test.jpg">
Bottom <br><br>
</td>
</tr>
</table>



结论:
center right
top bottom right




privacy policy     license    
© 2004-2005 HIOX INDIA - hioxindia.com

其它链接