• Html中table显示空单元格的方法及table标签属性总结


    这段时间因为公司限制域账户登录,在win7下无法上网,就切换到xp系统了,逐渐开始用office2007来发blog,还好基本上我在2010中用到的功能2007都有。

    今天在动态生成htm文件时发现自己以前的htm相关知识都忘了,所以要边用边搜索,顺便总结下。

    因为用table显示查询统计的表格,所以必须要让table中空的单元格可以显示出边框来,尝试过有两种方法:1.<td></td>中间加上&nbsp;,注意不能是直接空格,必须用&nbsp;才可以;2.在table属性中加入frame="border"。 表格边框的显示与隐藏,是可以用frame参数来控制的。请注意它只控制表格的边框图,而不影晌单元格。

    只显示上边框 &lt;table frame=above&gt;<br>

    只显示下边框 &lt;table frame=below&gt; <br>

    只显示左、右边框 &lt;table frame=vsides&gt;<br>

    只显示上、下边框 &lt;table frame=hsides&gt;<br>

    只显示左边框 &lt;table frame=lhs&gt;<br>

    只显示右边框 &lt;table frame=rhs&gt;<br>

    不显示任何边框 &lt;table frame=void&gt;</td>

    <table>标签的属性设置

    带边框的表格:
    <table border=1 >
    <tr><th>Food</th><th>Drink</th><th>Sweet</th>
    <tr><td>A</td><td>B</td><td>C</td>
    </table>

    Food

    Drink

    Sweet

    A

    B

    C

    不带边框的表格:
    <table> <tr><th>Food</th><th>Drink</th><th>Sweet</th> <tr><td>A</td><td>B</td><td>C</td> </table>

    Food

    Drink

    Sweet

    A

    B

    C

    边框尺寸设置: <table border=#> #=边框粗度

    <table border=10>

    <tr><th>Food</th><th>Drink</th><th>Sweet</th>

    <tr><td>A</td><td>B</td><td>C</td>

    </table>

    Food

    Drink

    Sweet

    A

    B

    C

    <table border width=# height=#>width:宽度,height:高度,#=象素
    设置表格宽度和高度:
    <table border width=170 height=100> <tr><th>Food</th><th>Drink</th><th>Sweet</th> <tr><td>A</td><td>B</td><td>C</td> </table>

    Food

    Drink

    Sweet

    A

    B

    C

    <table border cellspacing=#> #=象素

    表元间隙设置:
    <table border cellspacing=10> <tr><th>Food</th><th>Drink</th><th>Sweet</th> <tr><td>A</td><td>B</td><td>C</td> </table>

    Food

    Drink

    Sweet

    A

    B

    C

    <table border cellpadding=#> #=象素
    表元内部空白设置:
    <table border cellpadding=10> <tr><th>Food</th><th>Drink</th><th>Sweet</th> <tr><td>A</td><td>B</td><td>C</td> </table>

    Food

    Drink

    Sweet

    A

    B

    C

    <table align=#> #=left,right,center

    设置表格在网页中的布局位置:

    <table align="left" border>

    <tr><th>Food</th><th>Drink</th><th>Sweet</th>

    <tr><td>A</td><td>B</td><td>C</td>

    </table>

    My favorites...<br>

    cookies, chocolates, and more.

    Food

    Drink

    Sweet

    A

    B

    C

    My favorites...
    cookies, chocolates, and more.

    表格的标题
    <caption > 标题内容</caption>
    align=left,right,center valign=bottom,top

    <table border>

    <caption align=center>Lunch</caption>

    <tr><th>Food</th><th>Drink</th><th>Sweet</th>

    <tr><td>A</td><td>B</td><td>C</td>

    </table>

    Lunch

    Food

    Drink

    Sweet

    A

    B

    C

    表格边框的色彩
    <table bordercolor=#>

    <table cellspacing=5 border=5 bodercolor=#ffaa00>

    <tr><th>Food</th><th>Drink</th><th>Sweet</th>

    <tr><td>A</td><td>B</td><td>C</td>

    </table>

    Food

    Drink

    Sweet

    A

    B

    C

    表格边框色彩的亮度控制
    <table bordercolorlight=#>
    <table bordercolordark=#>

    <table
    cellspacing=5 border=5

    bordercolorlight=blue bordercolordark=Maroon>

    <tr><th>Food</th><th>Drink</th><th>Sweet</th>

    <tr><td>A</td><td>B</td><td>C</td>

    </table>

    Food

    Drink

    Sweet

    A

    B

    C

    注意htm中的颜色只能用#RRGGBB表示,比如说黑色就是#000000,而不能像delphi中那样写成clBlack(可能没有定义宏常量的原因)。

  • 相关阅读:
    如何获取汉字对应的拼音
    php each()函数和list()函数
    php list()函数
    addslashes给预定义字符前面加上反斜杠
    array_filter() 过滤数组中的空白元素
    用.htaccess文件实现URL重写
    xml中实体引用
    onsubmit阻止表单提交
    php获取当前文件绝对路径
    array_merge() 函数的用法
  • 原文地址:https://www.cnblogs.com/doit8791/p/2610866.html
Copyright © 2020-2023  润新知