CSS 位置的奇怪问题:绝对
我在 position:absolute
方面遇到了一些非常奇怪的问题。我已将 我的网页 的主标题设置为绝对位置,但是当我调整窗口大小时,文本会移动大约。真正奇怪的是,标语(圣经经文)也是 position:absolute
,但它没有任何问题。有什么建议吗?
I am having some really weird problems with position:absolute
. I have set the main title of my webpage to be position absolute, but when I resize the window, the text moves around. The really weird thing is that the tagline (the Bible verse) is also position:absolute
, but it isn't having any problems. Any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我猜你的屏幕分辨率是1920x1080?看起来您已经相对于窗口定位了元素,这仅在窗口具有该大小时才有效。
尝试删除
position:absolute
和right
属性,并使用float:right
而不是float:left
。至于标语元素,您将其设置为
position:relative
和float: right
。position:relative
在这里,绝对不执行任何操作。I'm guessing your screen resolution is 1920x1080? Looks like you've gone and positioned the element relative to the window, which only works if the window is that size.
Try removing the
position: absolute
and theright
properties, and usingfloat:right
instead offloat:left
.As for the tagline element, you made it
position: relative
andfloat: right
.position: relative
, here, does absolutely nothing.我建议将
position:relative
添加到#logoWrapper
中:因此其具有
position:absolute
的子项将相对于# 定位正如 Kolink 所说,logoWrapper
,而不是body
。I suggest adding the
position: relative
to the#logoWrapper
:Thus its children with
position: absolute
will be positioned relatively to the#logoWrapper
, not thebody
, as Kolink said.