如何在一个网页上固定元素相对于另一个元素的元素? [英] How can I make an element on a webpage fixed BUT relative to another element?

查看:191
本文介绍了如何在一个网页上固定元素相对于另一个元素的元素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个固定的元素,并且从屏幕左侧有一个边距。我想让这个元素正确的包装,而不是具有较小的分辨率或更大的人会有元素真的很远或真正接近我的包装。

I have an element that is fixed and has a margin from the left of the screen. I want to make this element right of a wrapper instead because people who have smaller resolutions or larger will have the element really far away or really close to my wrapper.

我希望这是有道理的! :S

I hope this makes sense! :S

谢谢

推荐答案

同样的元素是我不知道不可能的。

Using both fixed and relative on the same element is as far as I know impossible.

你可以做的是一个jQuery解决方案。

What you could do is a jQuery solution.

但是是固定位置真的有必要吗?如何修复包装器,然后只使用其他文档的相对位置相对于包装器?
这应该可以解决。

But is the fixed position really necessary? How about fixing the wrapper then just using relative on the other document to position it relative to the wrapper? That should solve it.

这篇关于如何在一个网页上固定元素相对于另一个元素的元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆