怎么使得html的表格有浮空效果?

html-css013

怎么使得html的表格有浮空效果?,第1张

首先要调整css,将该要悬浮的div设置position为absolute,并且定义好要显示的位置。然后剩下的就要用js去实现了,页面滚动的时候计算滚动的位置,实时修改与页面顶端的距离。

这种插件很多,在网上随便找一下都一大把。自己写的话稍微麻烦点。

老弟, 这种效果不需用到浮动, 不就是换个位置嘛

<table>

<tr>

<td class="a"></td>

<td class="b"></td>

</tr>

</table>

a - b的内容调换不就行了吗?

或许你可以用一个比较偷懒的方法   再建一个等高的div    放在最上端, 例如

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

        "

">

<html>

<head>

    <title></title>

    <style type="text/css">

        *{

            margin: 0

            padding: 0

        }

        .layoutRoot{

            width: 600px

            margin: 0 auto

        }

        .fix{

            width:100%

            height: 65px

            background-color: #cccccc

        }

        .fixed{

            position: fixed

            left: 0

            top: 0

        }

        .content{

            background-color: #c3f0ff

            height: 1000px

        }

    </style>

</head>

<body>

<div class="layoutRoot">

    <div class="fix fixed">我是一个悬浮窗</div>

    <div class="fix fixH"></div>

    <div class="content">这里是内容</div>

</div>

</body>

</html>