首页 > 其他 > 详细

col标签的相关实验

时间:2014-06-28 23:54:01      阅读:475      评论:0      收藏:0      [点我收藏+]

col上有width属性,如果对应值没有单位,默认是像素

<!DOCTYPE html>
<html>
    <head>
        <title>col相关实验</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" /> 
    </head>

    <body >
        <table border="1" width="100%">
            <col width="20"></col>
            <col width="50"></col>
            <col width="80"></col>

            <tr>
                <td>1</td>
                <td>2</td>
                <td>3</td>
                <td>4</td>
            </tr>
            <tr>
                <td>1</td>
                <td>2</td>
                <td>3</td>
                <td>4</td>
            </tr>
        </table>
    </body>
</html>

<!DOCTYPE html>
<html>
    <head>
        <title>col相关实验</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" /> 
    </head>

    <body >
        <table border="1" width="100%">
            <col width="20%"></col>
            <col width="20%"></col>
            <col width="30%"></col>

            <tr>
                <td>1</td>
                <td>2</td>
                <td>3</td>
                <td>4</td>
            </tr>
            <tr>
                <td>1</td>
                <td>2</td>
                <td>3</td>
                <td>4</td>
            </tr>
        </table>
    </body>
</html>

只有IE67才认align

<!DOCTYPE html>
<html>
    <head>
        <title>col相关实验</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" /> 
    </head>

    <body >
        <table border="1" width="100%">
            <col align="left" width="20%"></col>
            <col align="right" width="20%"></col>
            <col align="center" width="30%"></col>

            <tr>
                <td>1</td>
                <td>2</td>
                <td>3</td>
                <td>4</td>
            </tr>
            <tr>
                <td>1</td>
                <td>2</td>
                <td>3</td>
                <td>4</td>
            </tr>
        </table>
    </body>
</html>

IE, chrome, safari能认bgcolor,firefox不认。

<!DOCTYPE html>
<html>
    <head>
        <title>col相关实验</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" /> 
    </head>

    <body >
        <table border="1" width="100%">
            <col bgcolor="red" width="20%"/>
            <col bgcolor="blue" width="20%"/>
            <col bgcolor="yellow" width="30%" align="center"/>
            <col bgcolor="green" width="30%"/>
            <tr>
                <td>1</td>
                <td>2</td>
                <td>3</td>
                <td>4</td>
            </tr>
            <tr>
                <td>1</td>
                <td>2</td>
                <td>3</td>
                <td>4</td>
            </tr>
        </table>
    </body>
</html>

我们可以使用style,全部浏览器都认

<!DOCTYPE html>
<html>
    <head>
        <title>col相关实验</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" /> 
    </head>

    <body >
        <table border="1" width="100%">
            <col style="background: #2FECDC" width="20%"/>
            <col style="background: #FF77F1" width="20%"/>
            <col style="background: gold;text-align: center" width="30%" />
            <col style="background: greenyellow" width="30%"/>
            <tr>
                <td>1</td>
                <td>2</td>
                <td>3</td>
                <td>4</td>
            </tr>
            <tr>
                <td>1</td>
                <td>2</td>
                <td>3</td>
                <td>4</td>
            </tr>
        </table>
    </body>
</html>

还可以用类名


<!DOCTYPE html>
<html>
    <head>
        <title>col相关实验</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" /> 
        <style>
            .ccc{
                background: gold;
                text-align: center;
                font-weight: bold;
                width:40%;
            }
        </style>
    </head>

    <body >
        <table border="1" width="100%">
            <col style="background: #2FECDC" width="20%"/>
            <col style="background: #FF77F1" width="20%"/>
            <col class="ccc" />
            <col style="background: greenyellow"/>
            <tr>
                <td>1</td>
                <td>2</td>
                <td>3</td>
                <td>4</td>
            </tr>
            <tr>
                <td>1</td>
                <td>2</td>
                <td>3</td>
                <td>4</td>
            </tr>
        </table>
    </body>
</html>

col标签的相关实验,布布扣,bubuko.com

col标签的相关实验

原文:http://www.cnblogs.com/rubylouvre/p/3793023.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!