小编Sim*_*han的帖子

嵌套在另一个内联块元素中的内联块元素具有offsetTop

我是新学HTML,现在我有一些代码

<div id="container" style="height:300px;width:500px;font-size:0">
    <div id="leftBox" style="display: inline-block; background: pink; width: 50%; height: 100%;">
        <div id="wrapper" style="height:10%;">
            <div style="display: inline-block; background: red; width: 50%; height: 100%;"></div>
            <div style="display: inline-block; background: blue; width: 50%; height: 100%;"></div>
        </div>
    </div>
    <div id="rightBox" style="display: inline-block; background: green; width: 50%; height: 100%;"></div>
</div>
Run Code Online (Sandbox Code Playgroud)

(我在http://jsfiddle.net/Simon_Chan/Z3WyA/上发布了它)

你可以看到leftBox有一个很大的offsetTop,但是如果没有wrapper 或者 wrapper高度是100%或者没有rightBox 或者没有元素wrapper,那么在所有这些条件下leftBox都没有offsetTop.

为什么这样?以及如何删除它?

谢谢!

html css

8
推荐指数
1
解决办法
2819
查看次数

如何在js-ctypes中使用指针调用函数

我只有一个指向函数的指针,如何在js-ctypes中调用它?

谢谢.

firefox-addon jsctypes

5
推荐指数
1
解决办法
1169
查看次数

标签 统计

css ×1

firefox-addon ×1

html ×1

jsctypes ×1