网站首页 工具软件 操作系统 办公软件 网页制作 PHP教程 script脚本专栏 photoshop教程 其他精品教程
我发布的文章 - 教程搜索 - 交流论坛 - 帮助中心 - 网站首页 网络工具 - 常用工具 - 媒体工具 - 系统工具 - 实用工具 NT/2003 - Win Xp - Win2000 - DOS/Win9x - IE/注册表 - Linux - 苹 果 Office - Word - Excel - PowerPoint - 输入法 - 邮件处理 Flash - Dreamweaver - Fireworks - FrontPage - HTMLCSS 基础文章 - PHP函数 - PHP技巧 - 数据库相关 - 高级应用 - PHP安装 - 转载精华 - 常见问题 综 合 类 - 状 态 栏 - 游 戏 类 - 页面背景 - 页面特效 - 页面导航 - 文本操作 - 文本特效 - 图形特效 - 鼠标特效 - 时间日期 - 密 码 类 文字特效 - 按钮与图标 - 色彩运用 - 滤镜魔法 - 综合实例 XML教程 - DELPHI基础教程 - VB教程
首页 -> 网页制作 -> HTMLCSS

TOP

从HTML语言到网上家园 第五章
文章内容
相关信息
用户评论
文章内容

 

从HTML语言到网上家园 第五章 网页中的表格

  5.1表格的基本形式

  表格基本形式:
  〈table〉
   〈tr〉
   〈th〉……〈/th〉
   〈/tr〉
   〈tr〉
   〈td〉……〈/td〉
   〈/tr〉
  〈/table〉
  〈table〉……〈/table〉用于定义表格。〈tr〉定义表中的行,一个表中有多少行,就有多少个〈tr〉。〈th〉用于定义表头,〈td〉定义表元,表元中包含了表格的具体数据。

  5.2表格属性

  5.2.1表格边框设置

  和表格边框设置有关的〈table〉元素属性有:
  BORDER=n 定义表格边框宽度。BORDER=0 为无边框表格。
  BORDERCOLOR=color 设置表格边框颜色,当BORDER=0时此值无效。
  BORDERCOLORDARK=color 设置表格亮边框的颜色。
  BORDERCOLORLTGHT=color 设置表格暗边框的颜色。
  BORDERCOLORDARK 和BORDERCOLORLTGHT一起用来绘制三维边框,两者是相对立的,当BORDER=0时此两者无效。

例:
(1)无边框表格html代码:
〈table border="0" cellpadding="2" width=200〉
〈tr〉
〈th width="33%"〉姓名〈/th〉
〈th width="33%"〉性别〈/th〉
〈th width="34%"〉年龄〈/th〉
〈/tr〉
〈tr〉
〈td width="33%" align="center"〉李旦〈/td〉
〈td width="33%" align="center"〉男〈/td〉
〈td width="34%" align="center"〉14〈/td〉
〈/tr〉
〈/table〉
显示效果:
姓名 性别 年龄
李旦 14



(2)有边框表格html代码:
〈table align=center border="5" cellpadding="3" width=40% bordercolordark="#88DD88" bordercolorlight="#008000" bordercolor="#000080" cellspacing="3"〉
〈tr〉
〈th width="33%"〉〈font color="#000000"〉姓名〈/font〉〈/th〉
〈th width="33%"〉〈font color="#000000"〉性别〈/font〉〈/th〉
〈th width="34%"〉〈font color="#000000"〉年龄〈/font〉〈/th〉
〈/tr〉
〈tr〉
〈td width="33%" align="center"〉〈font color="#000000"〉李旦〈/font〉〈/td〉
〈td width="33%" align="center"〉〈font color="#000000"〉男〈/font〉〈/td〉
〈td width="34%" align="center"〉〈font color="#000000"〉14〈/font〉〈/td〉
〈/tr〉
〈/table〉
显示效果:
姓名 性别 年龄
李旦 14


在该表格中,外围宽边部分是表格边框,深绿色部分是亮边框,浅绿色部分是暗边框。

   以上是设置整个表格的边框和颜色,还可以为每个单元格设置独立的边框颜色。BORDERCOLOR,BORDERCOLORDARK和BORDERCOLORLTGHT属性对〈tr〉,〈td〉和〈th〉同样可用,用法与在〈table〉中相同。

例1:设置表中行元素〈tr〉的边框。
〈tr bordercolorlight="#008000" bordercolordark="#88DD88"〉
显示效果:
   
   

例2:设置表头元素〈th〉的边框。
〈th width="50%" bordercolor="#008000" bordercolorlight="#008000" bordercolordark="#88DD88" border=3〉 〈/th〉
〈th width="50%" bordercolor="#008000" border=3〉 〈/th〉
显示效果:
   
   

例3:设置表中单元格〈td〉的边框。
〈td width="50%" bordercolor="#008000" border=3〉 〈/td〉
〈td width="50%" bordercolorlight="#008000" bordercolordark="#88DD88" border=3〉 〈/td〉
显示效果:

   
   

 


相关信息
从HTML语言到网上家园 第五章
发布者:lfj
浏览量:567
发布日期:2005-03-08 13:38:05
所属专题:
用户评论
称  呼:
内  容:

广告位

广告招租,欢迎抢订

热门信息

·从HTML语言到网上家园 第一..
·从HTML语言到网上家园 第二..
·从HTML语言到网上家园 序章
·从HTML语言到网上家园 第三..
·从HTML语言到网上家园 第五章
·HTML:让网页超链接拥有多..
·个人网站制作全接触(中)
·个人网站制作全接触(下)

推荐信息