一、基本语法

 

 
  
  1. <table> \\表格标记 
  2.     <tr>    \\表格行标记 
  3.         <td>......</td>    \\单元格标记 
  4.         ... 
  5.         ... 
  6.     </tr> 
  7.      
  8.     .... 
  9.     .... 
  10.  
  11. </table> 

二、表格标记的常用属性,table,tr,td都可以使用

 

 
  
  1. 基本的 
  2. border  \\设置表格边框线的宽度 
  3. width,height    \\表格的宽度和高度 
  4. bgcolor     \\表格背景颜色 
  5. background  \\设置背景图像 
  6. bordercolor     \\设置边框颜色 
  7. bordercolorlight    \\亮边框颜色 
  8. bordercolordark     \\暗边框颜色 
  9.  
  10. 更多 
  11. cellspacing     \\设置单元格间距 
  12. cellpadding     \\设置单元格边距 
  13. align       \\设置表格水平对齐的方式 
  14. rowspan,colspan \\单元格跨行/单元格跨列 
  15. frame   \\设置表格边框的样式,是否显示 
  16.     --above \\显示上边框 
  17.     --below \\显示下边框 
  18.     --border,box    \\显示上下左右边框 
  19.     --lhs,rhs   \\显示左边框,显示右边框 
  20.     --hisdes,visdes \\显示上下边框,显示左右边框 
  21.     --void  \\不显示边框 
  22. rules   \\设置表格内部边框的样式,是否显示 
  23.     --all   \\显示所有内部边框 
  24.     --cols  \\仅显示行边框 
  25.     --groups    \\仅显示介于行列间的边框 
  26.     --none  \\不显示内部边框 
  27.     --rows  \\仅显示列边框 

 

三、简单示例,重点在table里面

 

 
  
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
  2. <html xmlns="http://www.w3.org/1999/xhtml"> 
  3. <head> 
  4. <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> 
  5. <title>首页</title> 
  6. </head> 
  7.  
  8. <body> 
  9. <table bgcolor="#CCCC33" width="366" height="151" border="0"> 
  10.   <tr> 
  11.     <td>1</td> 
  12.     <td>2</td> 
  13.     <td>3</td> 
  14.   </tr> 
  15.   <tr> 
  16.     <td>4</td> 
  17.     <td>5</td> 
  18.     <td>6</td> 
  19.   </tr> 
  20.   <tr> 
  21.     <td>7</td> 
  22.     <td>8</td> 
  23.     <td>9</td> 
  24.   </tr> 
  25. </table> 
  26. </body> 
  27. </html>