1

我正在开发一个位于每个页面右侧的跨浏览器扩展(附加组件)。现在,我将侧边栏覆盖在每个页面的顶部。但我更希望它单独位于每个页面的一侧,而不是隐藏父页面的任何部分。我一直在寻找答案,但没有运气。在某些浏览器中似乎有用于创建侧边栏的内置方法。但我正在寻找一种只涉及 html 和 css 的技术(如果需要,还可以使用 jquery)。

作为我正在寻找的一个例子,谷歌相关扩展位于每个页面的底部,但实际上在加载时会向上推页面的内容。

在此处输入图像描述

Widgya 插件是父页面内容的一部分,您可以看到 Google 相关如何将其推高以避免侵入页面。这是来自相关扩展的相关 html:

<div style="clear: both; height: 46px; width: 100%; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; position: relative; "></div>
<iframe class="grelated-iframe" frameborder="0" id="grelated_iframe_189" src="http://www.gstatic.com/webgps/grelated_0_6_9/html/grelated_bar_iframe.html" style="z-index: 2147483647; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; position: fixed; bottom: 0px; left: 0px; right: 0px; top: auto; width: 100%; height: 49px; " scrolling="no"></iframe>

使用调用'clear:both'的div和绝对位置的iframe,可以实现效果。但我似乎无法在屏幕的右侧或左侧重现这种效果。我尝试了各种方法都没有成功。我将不胜感激对采取的方法的任何见解。

谢谢

更新:

这是我想要达到的效果:

在此处输入图像描述

Chrome 有/有一个实验性的侧边栏 api,但我需要能够在 css 和 html 中执行此操作,而不依赖于特定于浏览器的 api。

4

1 回答 1

0

你的意思是“位置:固定”?我不认为“清除:两者”可以在滚动时使栏固定在某个位置。

一个简单的例子是通知栏

http://chat.stackoverflow.com/
于 2011-08-31T04:31:00.157 回答