+ -
当前位置:首页 → 问答吧 → style 和 怎样不影响其他的table?

style 和 怎样不影响其他的table?

时间:2011-06-07

来源:互联网

<style type="text/css"> </style> <---- 这段代码是什么? 要怎样用? 有哪些属性功能??

<="text/css"> <---- 这个意味着什么?? 我要怎样定义??

下面的代码有两个独立的table, 要怎样不让 tbody {color:red} 影响 第一个table? 因为我的目的想把 第二个table 的 tbody 变成红色~



HTML code

<html>
<head>
    <title></title>
    <style type="text/css">
        thead {color:green}
        tbody {color:red}
        tfoot {color:blue}
    </style>
</head>

<body>
    <table align="center">                      第一个Table
    <tr>    
        <td>Table (table)</td>
        <td>Table row (tr)</td>
        <td>Table/data cell (td)</td>
    </tr>
    <tr>
        <td>cell 4</td>
        <td>cell 5</td>
        <td>cell 6</td>
    </tr>
    </table>

    <table border="1">                          第二个Table
        <thead>
        <tr>
            <th>Table Header (th) 1</th>
            <th>Table Header (th) 2</th>
            <th>Table Header (th) 3</th>
        </tr>
        </thead>

        <tbody>
        <tr>
            <td>Table body</td>
            <td>Table body</td>
            <td>Table body</td>
        </tr>
        </tbody>
    </table>
</body>
</html>

作者: L3nnon   发布时间: 2011-06-07

<style type="text/css"> </style> 就是在里面定义页面的CSS样式。

你可以定义
.red {color:red}

调用的话 <tbody class="red">

作者: tcwsyt   发布时间: 2011-06-07

或者给第二个TABLE一个ID,然后用子类选择符定义到他下面的TBODY

作者: tcwsyt   发布时间: 2011-06-07

热门下载

更多